Index: ZPsycopgDA-2.4.6/ZPsycopgDA/db.py
===================================================================
--- ZPsycopgDA-2.4.6.orig/ZPsycopgDA/db.py	2014-04-17 23:45:16.540500142 +0200
+++ ZPsycopgDA-2.4.6/ZPsycopgDA/db.py	2014-04-18 00:02:08.269273308 +0200
@@ -50,8 +50,8 @@
     def getconn(self, init=True):
         # if init is False we are trying to get hold on an already existing
         # connection, so we avoid to (re)initialize it risking errors.
-        conn = pool.getconn(self.dsn)
-        if init:
+        conn, already_in_use = pool.getconn(self.dsn)
+        if not already_in_use:
             # use set_session where available as in these versions
             # set_isolation_level generates an extra query.
             if psycopg2.__version__ >= '2.4.2':
@@ -65,7 +65,7 @@
 
     def putconn(self, close=False):
         try:
-            conn = pool.getconn(self.dsn, False)
+            conn, already_in_use = pool.getconn(self.dsn, False)
         except AttributeError:
             pass
         pool.putconn(self.dsn, conn, close)
@@ -93,8 +93,9 @@
     def open(self):
         # this will create a new pool for our DSN if not already existing,
         # then get and immediately release a connection
-        self.getconn()
-        self.putconn()
+        #self.getconn()
+        #self.putconn()
+        pass
         
     def close(self):
         # FIXME: if this connection is closed we flush all the pool associated
Index: ZPsycopgDA-2.4.6/ZPsycopgDA/pool.py
===================================================================
--- ZPsycopgDA-2.4.6.orig/ZPsycopgDA/pool.py	2014-04-17 23:45:16.540500142 +0200
+++ ZPsycopgDA-2.4.6/ZPsycopgDA/pool.py	2014-04-17 23:58:47.372326630 +0200
@@ -64,21 +64,23 @@
         return self._keys
 
     def _getconn(self, key=None):
-        """Get a free connection and assign it to 'key' if not None."""
+        """Get a free connection and assign it to 'key' if not None.
+        Returns the connection and a flag that tells whether it was already
+        in use (by the same key)"""
         if self.closed: raise PoolError("connection pool is closed")
         if key is None: key = self._getkey()
 
         if key in self._used:
-            return self._used[key]
+            return self._used[key], True
 
         if self._pool:
             self._used[key] = conn = self._pool.pop()
             self._rused[id(conn)] = key
-            return conn
+            return conn, False
         else:
             if len(self._used) == self.maxconn:
                 raise PoolError("connection pool exausted")
-            return self._connect(key)
+            return self._connect(key), False
 
     def _putconn(self, conn, key=None, close=False):
         """Put away a connection."""
@@ -138,7 +140,8 @@
         self.__thread = thread
 
     def getconn(self):
-        """Generate thread id and return a connection."""
+        """Generate thread id and return a connection and a flag that tells
+        whether it was already in use (by the same thread)."""
         key = self.__thread.get_ident()
         self._lock.acquire()
         try:
