Author: phd
Date: 2005-10-28 15:35:08 +0000 (Fri, 28 Oct 2005)
New Revision: 1167
Modified:
SQLObject/branches/0.7-bugfix/sqlobject/col.py
SQLObject/branches/0.7-bugfix/sqlobject/postgres/__init__.py
SQLObject/branches/0.7-bugfix/sqlobject/postgres/pgconnection.py
Log:
Merged a patch from the revision 1156 from the trunk: adapted to psycopg2.
Modified: SQLObject/branches/0.7-bugfix/sqlobject/col.py
===================================================================
--- SQLObject/branches/0.7-bugfix/sqlobject/col.py 2005-10-28 15:34:24 UTC (rev 1166)
+++ SQLObject/branches/0.7-bugfix/sqlobject/col.py 2005-10-28 15:35:08 UTC (rev 1167)
@@ -30,7 +30,7 @@
from formencode import compound
from formencode import validators
from classregistry import findClass
-from converters import array_type
+from converters import array_type, buffer_type
from util.backports import count
NoDefault = sqlbuilder.NoDefault
@@ -1096,7 +1096,7 @@
if module.__name__ == "sqlite":
value = module.decode(value)
return value
- if isinstance(value, state.soObject._connection._binaryType):
+ if isinstance(value, (buffer_type, state.soObject._connection._binaryType)):
cachedValue = self._cachedValue
if cachedValue and cachedValue[1] == value:
return cachedValue[0]
Modified: SQLObject/branches/0.7-bugfix/sqlobject/postgres/__init__.py
===================================================================
--- SQLObject/branches/0.7-bugfix/sqlobject/postgres/__init__.py 2005-10-28 15:34:24 UTC (rev 1166)
+++ SQLObject/branches/0.7-bugfix/sqlobject/postgres/__init__.py 2005-10-28 15:35:08 UTC (rev 1167)
@@ -6,9 +6,12 @@
def isSupported():
try:
- import psycopg
+ import psycopg2
except ImportError:
- return False
+ try:
+ import psycopg
+ except ImportError:
+ return False
return True
registerConnection(['postgres', 'postgresql', 'psycopg'],
Modified: SQLObject/branches/0.7-bugfix/sqlobject/postgres/pgconnection.py
===================================================================
--- SQLObject/branches/0.7-bugfix/sqlobject/postgres/pgconnection.py 2005-10-28 15:34:24 UTC (rev 1166)
+++ SQLObject/branches/0.7-bugfix/sqlobject/postgres/pgconnection.py 2005-10-28 15:35:08 UTC (rev 1167)
@@ -23,7 +23,10 @@
self.module = pgdb
else:
if psycopg is None:
- import psycopg
+ try:
+ import psycopg2 as psycopg
+ except ImportError:
+ import psycopg
self.module = psycopg
# Register a converter for psycopg Binary type.
|