Użytkownik Jacek Kałucki napisał:
> Użytkownik Ed Leafe napisał:
>
>> I just pushed a fix. I went with a minimally invasive approach, rather
>> than something that always ran the code, since 99%+ of the time it isn't
>> needed.
>>
>> It works with a PostgreSQL double precision column in my tests; let me
>> know if it solves your issues.
>>
>>
> I modified your patch a bit and it works now:
>
>
Yet another correction, for proper handling unicode type:
--- dCursorMixin.py (revision 5627)
+++ dCursorMixin.py (working copy)
@@ -198,23 +198,26 @@
self.DataStructure reports. The latter can happen with SQLite,
for example,
which only knows about a quite limited number of types.
"""
+ if field_val is None:
+ return field_val
ret = field_val
- if _newQuery or (field_name in self._fieldsToAlwaysCorrectType):
- pythonType = self._types.get(field_name, type(field_val))
+ if _newQuery or (field_name in self._fieldsToAlwaysCorrectType):
+ pythonType = self._types.get(field_name, None)
if pythonType is None or pythonType == type(None):
pythonType = self._types[field_name] =
dabo.db.getDataType(type(field_val))
- self._fieldsToAlwaysCorrectType.append(field_name)
- if pythonType is None or isinstance(field_val, pythonType):
+ if isinstance(field_val, str) and self._convertStrToUnicode:
+ # convert to unicode
+ pass
+ elif pythonType is None or isinstance(field_val, pythonType):
# No conversion needed.
return ret
+ else:
+ self._fieldsToAlwaysCorrectType.append(field_name)
if pythonType in (unicode,):
# Unicode conversion happens below.
pass
- elif field_val is None:
- # Fields of any type can be None (NULL).
- return field_val
elif pythonType in (datetime.datetime, ) and
isinstance(field_val, basestring):
ret = dates.getDateTimeFromString(field_val)
if ret is None:
--
Regards
Jacek Kałucki
_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://leafe.com/mailman/listinfo/dabo-users
Searchable Archives: http://leafe.com/archives/search/dabo-users
This message: http://leafe.com/archives/byMID/[email protected]