mirror of https://github.com/django/django.git
Added django.utils.six.buffer_types
and used it in the Oracle SchemaEditor. Refs #22715.
This commit is contained in:
parent
50b9313e0a
commit
06c0e740a4
|
@ -24,8 +24,7 @@ class DatabaseSchemaEditor(BaseDatabaseSchemaEditor):
|
||||||
return "'%s'" % value
|
return "'%s'" % value
|
||||||
elif isinstance(value, six.string_types):
|
elif isinstance(value, six.string_types):
|
||||||
return "'%s'" % six.text_type(value).replace("\'", "\'\'")
|
return "'%s'" % six.text_type(value).replace("\'", "\'\'")
|
||||||
elif (isinstance(value, six.memoryview) or
|
elif isinstance(value, six.buffer_types):
|
||||||
six.PY3 and isinstance(value, bytes)):
|
|
||||||
return "'%s'" % force_text(binascii.hexlify(value))
|
return "'%s'" % force_text(binascii.hexlify(value))
|
||||||
elif isinstance(value, bool):
|
elif isinstance(value, bool):
|
||||||
return "1" if value else "0"
|
return "1" if value else "0"
|
||||||
|
|
|
@ -667,6 +667,7 @@ if PY3:
|
||||||
_assertRaisesRegex = "assertRaisesRegex"
|
_assertRaisesRegex = "assertRaisesRegex"
|
||||||
_assertRegex = "assertRegex"
|
_assertRegex = "assertRegex"
|
||||||
memoryview = memoryview
|
memoryview = memoryview
|
||||||
|
buffer_types = (bytes, bytearray, memoryview)
|
||||||
else:
|
else:
|
||||||
_assertCountEqual = "assertItemsEqual"
|
_assertCountEqual = "assertItemsEqual"
|
||||||
_assertRaisesRegex = "assertRaisesRegexp"
|
_assertRaisesRegex = "assertRaisesRegexp"
|
||||||
|
@ -678,6 +679,7 @@ else:
|
||||||
memoryview = memoryview
|
memoryview = memoryview
|
||||||
else:
|
else:
|
||||||
memoryview = buffer
|
memoryview = buffer
|
||||||
|
buffer_types = (bytearray, memoryview)
|
||||||
|
|
||||||
|
|
||||||
def assertCountEqual(self, *args, **kwargs):
|
def assertCountEqual(self, *args, **kwargs):
|
||||||
|
|
Loading…
Reference in New Issue