Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Fixed #13161 - UNICODE registering changed

Previously, Django would register UNICODE extensions for psycopg2 at global scope, causing all other Python applications running under the same interpreter to be fed Unicode objects instead of expected strings. This would break those applications.
Now Django will register UNICODE only on per-cursor basic, so other applications will be unaffected.
  • Loading branch information...
commit 6595ee896a9e3bf9cc1a9bd34af0e13bd32d8a3b 1 parent 69597e5
@piotrmaslanka piotrmaslanka authored
Showing with 1 addition and 1 deletion.
  1. +1 −1  django/db/backends/postgresql_psycopg2/base.py
View
2  django/db/backends/postgresql_psycopg2/base.py
@@ -29,7 +29,6 @@
DatabaseError = Database.DatabaseError
IntegrityError = Database.IntegrityError
-psycopg2.extensions.register_type(psycopg2.extensions.UNICODE)
psycopg2.extensions.register_adapter(SafeBytes, psycopg2.extensions.QuotedString)
psycopg2.extensions.register_adapter(SafeText, psycopg2.extensions.QuotedString)
@@ -211,6 +210,7 @@ def _cursor(self):
self.init_connection_state()
connection_created.send(sender=self.__class__, connection=self)
cursor = self.connection.cursor()
+ psycopg2.extensions.register_type(psycopg2.extensions.UNICODE, cursor)
cursor.tzinfo_factory = utc_tzinfo_factory if settings.USE_TZ else None
return CursorWrapper(cursor)
Please sign in to comment.
Something went wrong with that request. Please try again.