summaryrefslogtreecommitdiff
path: root/python/skytools/psycopgwrapper.py
diff options
context:
space:
mode:
authorMartin Pihlak2012-08-16 09:47:10 +0000
committerMartin Pihlak2012-08-16 09:47:10 +0000
commite1c22bd6d598dcf86a2a930bd19904e330b085b6 (patch)
treec32d23315afe3d3c15b24f62dcc212df03e34671 /python/skytools/psycopgwrapper.py
parent37e91db8fb3a1fcd9a7a54934a2e882a5a953d0c (diff)
parentf8d90af0912db0a2ed29aa5e8fb912be3ab309a6 (diff)
Merge branch 'master' of internal-git:/git/dba/skytools-3
Diffstat (limited to 'python/skytools/psycopgwrapper.py')
-rw-r--r--python/skytools/psycopgwrapper.py10
1 files changed, 8 insertions, 2 deletions
diff --git a/python/skytools/psycopgwrapper.py b/python/skytools/psycopgwrapper.py
index 8c6d90b6..7cca9e23 100644
--- a/python/skytools/psycopgwrapper.py
+++ b/python/skytools/psycopgwrapper.py
@@ -107,8 +107,14 @@ class _CompatCursor(psycopg2.extras.DictCursor):
class _CompatConnection(psycopg2.extensions.connection):
"""Connection object that uses _CompatCursor."""
my_name = '?'
- def cursor(self):
- return psycopg2.extensions.connection.cursor(self, cursor_factory = _CompatCursor)
+ def cursor(self, name = None):
+ if name:
+ return psycopg2.extensions.connection.cursor(self,
+ cursor_factory = _CompatCursor,
+ name = name)
+ else:
+ return psycopg2.extensions.connection.cursor(self,
+ cursor_factory = _CompatCursor)
def connect_database(connstr, keepalive = True,
tcp_keepidle = 4 * 60, # 7200