[SQL-CVS] r814 - trunk/SQLObject/sqlobject
SQLObject is a Python ORM.
Brought to you by:
ianbicking,
phd
From: <sub...@co...> - 2005-06-10 13:23:46
|
Author: phd Date: 2005-06-10 13:23:37 +0000 (Fri, 10 Jun 2005) New Revision: 814 Modified: trunk/SQLObject/sqlobject/converters.py Log: Minor fix for Python 2.2: array.array is a function in 2.2, not a class. Modified: trunk/SQLObject/sqlobject/converters.py =================================================================== --- trunk/SQLObject/sqlobject/converters.py 2005-06-10 12:48:30 UTC (rev 813) +++ trunk/SQLObject/sqlobject/converters.py 2005-06-10 13:23:37 UTC (rev 814) @@ -1,4 +1,5 @@ import array +array_type = type(array.array('c', '')) # In Python 2.2 array.array is a function try: import mx.DateTime.ISO @@ -91,7 +92,7 @@ lookupConverter = converters.lookupConverter def StringLikeConverter(value, db): - if isinstance(value, array.array): + if isinstance(value, array_type): try: value = value.tounicode() except ValueError: @@ -108,7 +109,7 @@ registerConverter(type(""), StringLikeConverter) registerConverter(type(u""), StringLikeConverter) -registerConverter(array.array, StringLikeConverter) +registerConverter(array_type, StringLikeConverter) def IntConverter(value, db): return repr(int(value)) |