Ticket #1370: dCursorMixin.py.patch
| File dCursorMixin.py.patch, 1.3 kB (added by JacekK, 2 years ago) |
|---|
-
dCursorMixin.py
old new 954 954 except KeyError: 955 955 fldType = self._fldTypeFromDB(fld) 956 956 nonUpdateFields = self.getNonUpdateFields() 957 if fldType is not None :957 if fldType is not None and val is not None: 958 958 if fldType != type(val): 959 959 convTypes = (str, unicode, int, float, long, complex) 960 if is instance(val, convTypes) and isinstance(rec[fld], basestring):961 if is instance(fldType, str):960 if issubclass(fldType, basestring) and isinstance(val, convTypes): 961 if issubclass(fldType, str): 962 962 val = ustr(val) 963 963 else: 964 964 val = unicode(val) 965 elif is instance(rec[fld], int) and isinstance(val, bool):965 elif issubclass(fldType, int) and isinstance(val, bool): 966 966 # convert bool to int (original field val was bool, but UI 967 967 # changed to int. 968 968 val = int(val) 969 elif is instance(rec[fld], int) and isinstance(val, long):969 elif issubclass(fldType, int) and isinstance(val, long): 970 970 # convert long to int (original field val was int, but UI 971 971 # changed to long. 972 972 val = int(val) 973 elif is instance(rec[fld], long) and isinstance(val, int):973 elif issubclass(fldType, long) and isinstance(val, int): 974 974 # convert int to long (original field val was long, but UI 975 975 # changed to int. 976 976 val = long(val)
