1
0
Fork 0

Merge pull request #209 from amjith/json_py3_handler

Register the json handler only for PY2.
This commit is contained in:
Amjith Ramanujam 2015-04-18 20:13:05 -07:00
commit 09abde0ce6
1 changed files with 5 additions and 2 deletions

View File

@ -4,7 +4,7 @@ import psycopg2.extras
import psycopg2.extensions as ext
import sqlparse
from .packages import pgspecial
from .encodingutils import unicode2utf8
from .encodingutils import unicode2utf8, PY2, PY3
_logger = logging.getLogger(__name__)
@ -153,7 +153,10 @@ class PGExecute(object):
See http://initd.org/psycopg/docs/connection.html#connection.encoding
"""
return json_data.decode(self.conn.encoding)
if PY2:
return json_data.decode(self.conn.encoding)
else:
return json_data
def run(self, statement):
"""Execute the sql in the database and return the results. The results