diff options
author | Daniele Varrazzo <daniele.varrazzo@gmail.com> | 2012-09-19 04:26:35 +0100 |
---|---|---|
committer | Daniele Varrazzo <daniele.varrazzo@gmail.com> | 2012-09-19 04:26:35 +0100 |
commit | 024f0dbada97fa5f9718f7d622dba232ac4ca65a (patch) | |
tree | fa3b5724d8b25f40ec9d5273165537fa641425ec /lib/extensions.py | |
parent | b8e7f022560343c744e2576da478597a61f01575 (diff) | |
download | psycopg2-024f0dbada97fa5f9718f7d622dba232ac4ca65a.tar.gz |
Added json typecaster
Diffstat (limited to 'lib/extensions.py')
-rw-r--r-- | lib/extensions.py | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/lib/extensions.py b/lib/extensions.py index bb8e3dd..066373c 100644 --- a/lib/extensions.py +++ b/lib/extensions.py @@ -150,6 +150,20 @@ class NoneAdapter(object): return _null +# Create default json typecasters for PostgreSQL 9.2 oids +from psycopg2._json import create_json_typecasters + +try: + JSON, JSONARRAY = create_json_typecasters(114, 199) +except ImportError: + pass +else: + register_type(JSON) + register_type(JSONARRAY) + +del create_json_typecasters + + # Add the "cleaned" version of the encodings to the key. # When the encoding is set its name is cleaned up from - and _ and turned # uppercase, so an encoding not respecting these rules wouldn't be found in the |