summaryrefslogtreecommitdiff
path: root/django/db/backends/oracle/schema.py
diff options
context:
space:
mode:
authorShai Berger <shai@platonix.com>2014-05-28 18:57:40 +0300
committerShai Berger <shai@platonix.com>2014-05-28 18:57:40 +0300
commitfd427f1fe3c563d5fe0badfec0a39d6cd43454da (patch)
tree053f87a4388c19fc332597c51545e8949fb5bade /django/db/backends/oracle/schema.py
parente97b7a26779054e7bb4326c688b0ed7823037dec (diff)
downloaddjango-fd427f1fe3c563d5fe0badfec0a39d6cd43454da.tar.gz
Fixed #22715: Corrected sql for defaults of BinaryField on Oracle with Python3
While at it, fixed a problem in returning empty values (still with BinaryField/Oracle/Python3).
Diffstat (limited to 'django/db/backends/oracle/schema.py')
-rw-r--r--django/db/backends/oracle/schema.py6
1 files changed, 4 insertions, 2 deletions
diff --git a/django/db/backends/oracle/schema.py b/django/db/backends/oracle/schema.py
index 7843b96943..986cd95e75 100644
--- a/django/db/backends/oracle/schema.py
+++ b/django/db/backends/oracle/schema.py
@@ -3,6 +3,7 @@ import datetime
import binascii
from django.utils import six
+from django.utils.text import force_text
from django.db.backends.schema import BaseDatabaseSchemaEditor
from django.db.utils import DatabaseError
@@ -23,8 +24,9 @@ class DatabaseSchemaEditor(BaseDatabaseSchemaEditor):
return "'%s'" % value
elif isinstance(value, six.string_types):
return "'%s'" % six.text_type(value).replace("\'", "\'\'")
- elif isinstance(value, buffer):
- return "'%s'" % binascii.hexlify(value)
+ elif (isinstance(value, six.memoryview) or
+ six.PY3 and isinstance(value, bytes)):
+ return "'%s'" % force_text(binascii.hexlify(value))
elif isinstance(value, bool):
return "1" if value else "0"
else: