]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commitdiff
r810@lightspeed: robert | 2006-01-10 11:49:18 +1100
authorRobert Leftwich <rtl@pobox.com>
Tue, 10 Jan 2006 00:49:47 +0000 (00:49 +0000)
committerRobert Leftwich <rtl@pobox.com>
Tue, 10 Jan 2006 00:49:47 +0000 (00:49 +0000)
 Added check for __version__ to determine if pyscopg is v1 or v2

lib/sqlalchemy/databases/postgres.py

index 7cfcb8382f5a605770918234ccdc993810d85e72..6b1dbef465c0cf3f59578f5230fefa7f43252076 100644 (file)
@@ -118,10 +118,16 @@ class PGSQLEngine(ansisql.ANSISQLEngine):
         else:
             self.module = module
         # figure psycopg version 1 or 2    
-        if self.module.__name__.endswith('psycopg2'):
-            self.version = 2
-        else:
-            self.version = 1
+       try:
+           if self.module.__version__.startswith('2'):
+               self.version = 2
+           else:
+               self.version = 1
+       except:
+           if self.module.__name__.endswith('psycopg2'):
+               self.version = 2
+           else:
+               self.version = 1
         self.opts = opts or {}
         ansisql.ANSISQLEngine.__init__(self, **params)