summaryrefslogtreecommitdiff
path: root/lib/extras.py
diff options
context:
space:
mode:
Diffstat (limited to 'lib/extras.py')
-rw-r--r--lib/extras.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/lib/extras.py b/lib/extras.py
index afafd8e..fe8db0a 100644
--- a/lib/extras.py
+++ b/lib/extras.py
@@ -573,6 +573,9 @@ def wait_select(conn):
def _solve_conn_curs(conn_or_curs):
"""Return the connection and a DBAPI cursor from a connection or cursor."""
+ if conn_or_curs is None:
+ raise psycopg2.ProgrammingError("no connection or cursor provided")
+
if hasattr(conn_or_curs, 'execute'):
conn = conn_or_curs.connection
curs = conn.cursor(cursor_factory=_cursor)
@@ -946,4 +949,8 @@ def register_composite(name, conn_or_curs, globally=False, factory=None):
return caster
+# expose the json adaptation stuff into the module
+from psycopg2._json import json, Json, register_json, register_default_json
+
__all__ = filter(lambda k: not k.startswith('_'), locals().keys())
+