summaryrefslogtreecommitdiff
path: root/lib/extras.py
diff options
context:
space:
mode:
authorDaniele Varrazzo <daniele.varrazzo@gmail.com>2012-09-27 00:41:04 +0100
committerDaniele Varrazzo <daniele.varrazzo@gmail.com>2012-09-27 00:41:04 +0100
commitdda24f082fbb5cfffc922f9cc6651c73b56b56f0 (patch)
tree38db92e9b99fd50f0ebfe3b67ea4a2cfe88b47fa /lib/extras.py
parent33043cd03810fd65483d53918a49576c1c143bbf (diff)
parent465b5cf280f6fe434d2f2fdd5d75d9c28723bac5 (diff)
downloadpsycopg2-dda24f082fbb5cfffc922f9cc6651c73b56b56f0.tar.gz
Merge branch 'json' into devel
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())
+