Ticket #13161: base.py.diff13161

File base.py.diff13161, 1.0 KB (added by Piotr Maślanka, 8 years ago)

git patch fixing the problem

Line 
1diff --git a/django/db/backends/postgresql_psycopg2/base.py b/django/db/backends/postgresql_psycopg2/base.py
2index 013aaaa..d7b159f 100644
3--- a/django/db/backends/postgresql_psycopg2/base.py
4+++ b/django/db/backends/postgresql_psycopg2/base.py
5@@ -29,7 +29,6 @@ except ImportError as e:
6 DatabaseError = Database.DatabaseError
7 IntegrityError = Database.IntegrityError
8 
9-psycopg2.extensions.register_type(psycopg2.extensions.UNICODE)
10 psycopg2.extensions.register_adapter(SafeBytes, psycopg2.extensions.QuotedString)
11 psycopg2.extensions.register_adapter(SafeText, psycopg2.extensions.QuotedString)
12 
13@@ -211,6 +210,7 @@ class DatabaseWrapper(BaseDatabaseWrapper):
14             self.init_connection_state()
15             connection_created.send(sender=self.__class__, connection=self)
16         cursor = self.connection.cursor()
17+        psycopg2.extensions.register_type(psycopg2.extensions.UNICODE, cursor)
18         cursor.tzinfo_factory = utc_tzinfo_factory if settings.USE_TZ else None
19         return CursorWrapper(cursor)
20 
Back to Top