pgtoolkit/pgmanager.py
changeset 23 dc2dbe872fc8
parent 20 73f0d53fef6b
child 24 5664afa530e5
--- a/pgtoolkit/pgmanager.py	Tue Dec 06 17:11:21 2011 +0100
+++ b/pgtoolkit/pgmanager.py	Wed Dec 14 16:29:33 2011 +0100
@@ -189,10 +189,12 @@
         for conn in tuple(self.conn_known.keys()):
             self.destroy_conn(conn)
 
-    def create_conn(self, name='default', isolation_level=None, keep_alive=True, dsn=None, **kw):
+    def create_conn(self, name='default', keep_open=1, isolation_level=None, keep_alive=True, dsn=None, **kw):
         '''Create named connection.
         
         name -- name for connection (default is "default")
+        keep_open -- how many connections will be kept open in pool (more connections will still be created,
+                     but they will be closed by put_conn)
         isolation_level -- "autocommit", "read_committed", "serializable" or None for driver default
         keep_alive -- set socket to keepalive mode
         dsn -- string with connection parameters (dsn means Data Source Name)
@@ -207,7 +209,7 @@
             dsn = ' '.join([x[0]+'='+str(x[1]) for x in kw.items() if x[1] is not None])
 
         isolation_level = self._normalize_isolation_level(isolation_level)
-        ci = ConnectionInfo(dsn, isolation_level, keep_alive)
+        ci = ConnectionInfo(dsn, isolation_level, keep_alive, keep_open=keep_open)
 
         self.conn_known[name] = ci
         self.conn_pool[name] = []