summaryrefslogtreecommitdiff
path: root/python/skytools/psycopgwrapper.py
diff options
context:
space:
mode:
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