Description: A bug caused by psycopg2 recently added a new boolean not callable autocommit attribute was fixed.
Origin:      upstream, http://sourceforge.net/mailarchive/message.php?msg_id=27799824
Bug-Debian:  http://bugs.debian.org/633843
Author:      phd
Last-Update: 2012-01-14

--- a/sqlobject/postgres/pgconnection.py
+++ b/sqlobject/postgres/pgconnection.py
@@ -117,7 +117,10 @@
     def _setAutoCommit(self, conn, auto):
         # psycopg2 does not have an autocommit method.
         if hasattr(conn, 'autocommit'):
-            conn.autocommit(auto)
+            try:
+                conn.autocommit(auto)
+            except TypeError:
+                conn.autocommit = auto
 
     def makeConnection(self):
         try:
@@ -127,10 +130,7 @@
                 conn = self.module.connect(**self.dsn_dict)
         except self.module.OperationalError, e:
             raise self.module.OperationalError("%s; used connection string %r" % (e, self.dsn))
-        if self.autoCommit:
-            # psycopg2 does not have an autocommit method.
-            if hasattr(conn, 'autocommit'):
-                conn.autocommit(1)
+        if self.autoCommit: self._setAutoCommit(conn, 1)
         c = conn.cursor()
         if self.schema:
             c.execute("SET search_path TO " + self.schema)
