summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJani Tiainen <redetin@gmail.com>2013-01-15 15:05:58 +0200
committerAnssi Kääriäinen <akaariai@gmail.com>2013-01-19 09:27:16 +0200
commitd194f290571f7e9dda7d2fd7a6f2b171120f2f14 (patch)
tree834f2d4263c92558913afc27f7abd02ce77541fc
parent0375244eaeae1e2c09cc58c4c62e8f9e951217d0 (diff)
Fixed #19606 -- Adjusted cx_Oracle unicode detection.
-rw-r--r--django/db/backends/oracle/base.py9
1 files changed, 5 insertions, 4 deletions
diff --git a/django/db/backends/oracle/base.py b/django/db/backends/oracle/base.py
index c6f072df3b..17faa17270 100644
--- a/django/db/backends/oracle/base.py
+++ b/django/db/backends/oracle/base.py
@@ -58,10 +58,11 @@ from django.utils import timezone
DatabaseError = Database.DatabaseError
IntegrityError = Database.IntegrityError
-
-# Check whether cx_Oracle was compiled with the WITH_UNICODE option. This will
-# also be True in Python 3.0.
-if int(Database.version.split('.', 1)[0]) >= 5 and not hasattr(Database, 'UNICODE'):
+# Check whether cx_Oracle was compiled with the WITH_UNICODE option if cx_Oracle is pre-5.1. This will
+# also be True for cx_Oracle 5.1 and in Python 3.0. See #19606
+if int(Database.version.split('.', 1)[0]) >= 5 and \
+ (int(Database.version.split('.', 2)[1]) >= 1 or
+ not hasattr(Database, 'UNICODE')):
convert_unicode = force_text
else:
convert_unicode = force_bytes