From 024f0dbada97fa5f9718f7d622dba232ac4ca65a Mon Sep 17 00:00:00 2001 From: Daniele Varrazzo Date: Wed, 19 Sep 2012 04:26:35 +0100 Subject: Added json typecaster --- lib/extensions.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'lib/extensions.py') 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 -- cgit v1.2.1