dabo Commit
Revision 2150
Date: 2006-05-14 04:04:07 -0700 (Sun, 14 May 2006)
Author: ed

Changed:
U   trunk/dabo/db/dCursorMixin.py

Log:
Added additional automatic data type conversions between int and long.


Diff:
Modified: trunk/dabo/db/dCursorMixin.py
===================================================================
--- trunk/dabo/db/dCursorMixin.py       2006-05-13 13:29:00 UTC (rev 2149)
+++ trunk/dabo/db/dCursorMixin.py       2006-05-14 11:04:07 UTC (rev 2150)
@@ -673,17 +673,24 @@
                                                        else:
                                                                val = 
unicode(val)
                                                elif isinstance(rec[fld], int) 
and isinstance(val, bool):
-                                                       # convert bool to int 
(original field val was int, but UI
+                                                       # convert bool to int 
(original field val was bool, but UI
                                                        # changed to int. 
                                                        val = int(val)
+                                               elif isinstance(rec[fld], int) 
and isinstance(val, long):
+                                                       # convert long to int 
(original field val was int, but UI
+                                                       # changed to long. 
+                                                       val = int(val)
+                                               elif isinstance(rec[fld], long) 
and isinstance(val, int):
+                                                       # convert int to long 
(original field val was long, but UI
+                                                       # changed to int. 
+                                                       val = long(val)
+
                                        if fldType != type(val):
                                                ignore = False
                                                # Date and DateTime types are 
handled as character, even if the 
                                                # native field type is not. 
Ignore these. NOTE: we have to deal with the 
                                                # string representation of 
these classes, as there is no primitive for either
                                                # 'DateTime' or 'Date'.
-                                               
-                                               
                                                dtStrings = ("<type 
'DateTime'>", "<type 'Date'>", "<type 'datetime.datetime'>")
                                                if str(fldType) in dtStrings 
and isinstance(val, basestring):
                                                                ignore = True




_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://leafe.com/mailman/listinfo/dabo-dev

Reply via email to