summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorShai Berger <shai.berger@healarium.com>2013-05-16 18:30:52 +0300
committerShai Berger <shai.berger@healarium.com>2013-05-18 14:19:26 +0300
commit215647c0f7614abe4fe0cd76bc70dd7b02f829b4 (patch)
tree9f12ed25d67bdfde932101f59bbbd71eb63f0e3b
parent340115200f459d02e9a3e61c9704653215e185d5 (diff)
Fixed #20386 - Introspection problem on Oracle
Made introspection always return a unicode as column name on Oracle. Thanks aaugustin for review and suggestion to use force_text().
-rw-r--r--django/db/backends/oracle/introspection.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/django/db/backends/oracle/introspection.py b/django/db/backends/oracle/introspection.py
index ff56dca5c2..608901f081 100644
--- a/django/db/backends/oracle/introspection.py
+++ b/django/db/backends/oracle/introspection.py
@@ -1,4 +1,5 @@
from django.db.backends import BaseDatabaseIntrospection, FieldInfo
+from django.utils.encoding import force_text
import cx_Oracle
import re
@@ -48,7 +49,8 @@ class DatabaseIntrospection(BaseDatabaseIntrospection):
cursor.execute("SELECT * FROM %s WHERE ROWNUM < 2" % self.connection.ops.quote_name(table_name))
description = []
for desc in cursor.description:
- description.append(FieldInfo(*((desc[0].lower(),) + desc[1:])))
+ name = force_text(desc[0]) # cx_Oracle always returns a 'str' on both Python 2 and 3
+ description.append(FieldInfo(*(name.lower(),) + desc[1:]))
return description
def table_name_converter(self, name):