# HG changeset patch # User Goffi # Date 1407942089 -7200 # Node ID f17034e4cf4afc5344536094017aae54d83df2cf # Parent 9df844d9d5ac8a21c93d3a8dea0357c5dc5a51a2 fixed unicode handling with psycopg2 diff -r 9df844d9d5ac -r f17034e4cf4a sat_pubsub/pgsql_storage.py --- a/sat_pubsub/pgsql_storage.py Wed Aug 13 17:01:08 2014 +0200 +++ b/sat_pubsub/pgsql_storage.py Wed Aug 13 17:01:29 2014 +0200 @@ -64,6 +64,9 @@ from sat_pubsub import error, iidavoll, const import psycopg2 +import psycopg2.extensions +psycopg2.extensions.register_type(psycopg2.extensions.UNICODE) +psycopg2.extensions.register_type(psycopg2.extensions.UNICODEARRAY) class Storage: @@ -88,7 +91,6 @@ def __init__(self, dbpool): self.dbpool = dbpool - def getNode(self, nodeIdentifier): return self.dbpool.runInteraction(self._getNode, nodeIdentifier) @@ -408,7 +410,7 @@ subscriptions = [] for row in rows: - subscriber = jid.JID('%s/%s' % (row[0], row[1])) + subscriber = jid.JID(u'%s/%s' % (row[0], row[1])) options = {} if row[3]: