[SQL-CVS] r756 - trunk/SQLObject/sqlobject
SQLObject is a Python ORM.
Brought to you by:
ianbicking,
phd
From: <sub...@co...> - 2005-05-02 15:55:31
|
Author: phd Date: 2005-05-02 15:55:25 +0000 (Mon, 02 May 2005) New Revision: 756 Modified: trunk/SQLObject/sqlobject/converters.py Log: Commited bugfix from the bug N 1123687. Thanks to als for testing. Modified: trunk/SQLObject/sqlobject/converters.py =================================================================== --- trunk/SQLObject/sqlobject/converters.py 2005-05-02 09:41:55 UTC (rev 755) +++ trunk/SQLObject/sqlobject/converters.py 2005-05-02 15:55:25 UTC (rev 756) @@ -1,3 +1,5 @@ +import array + try: import mx.DateTime.ISO origISOStr = mx.DateTime.ISO.strGMT @@ -20,7 +22,7 @@ import Sybase NumericType=Sybase.NumericType except ImportError: - NumericType = None + NumericType = None if type(1==1) == type(1): class BOOL(object): @@ -89,6 +91,12 @@ lookupConverter = converters.lookupConverter def StringLikeConverter(value, db): + if isinstance(value, array.array): + try: + value = value.tounicode() + except ValueError: + value = value.tostring() + if db in ('mysql', 'postgres'): for orig, repl in sqlStringReplace: value = value.replace(orig, repl) @@ -100,6 +108,7 @@ registerConverter(type(""), StringLikeConverter) registerConverter(type(u""), StringLikeConverter) +registerConverter(array.array, StringLikeConverter) def IntConverter(value, db): return repr(int(value)) |