Ticket #20785: oracle-10.patch

File oracle-10.patch, 1010 bytes (added by Shai Berger, 8 years ago)

Make Oracle backend not use unicode literals to work around Oracle 10 bug

  • django/db/backends/oracle/base.py

    diff --git a/django/db/backends/oracle/base.py b/django/db/backends/oracle/base.py
    index 2d51d24..7539074 100644
    a b Oracle database backend for Django. 
    33
    44Requires cx_Oracle: http://cx-oracle.sourceforge.net/
    55"""
    6 from __future__ import unicode_literals
     6#from __future__ import unicode_literals # unicode_literals break things on Oracle 10 and 11.1
    77
    88import decimal
    99import re
    WHEN (new.%(col_name)s IS NULL) 
    219219        # string instead of null, but only if the field accepts the
    220220        # empty string.
    221221        if value is None and field and field.empty_strings_allowed:
    222             value = ''
     222            value = six.text_type('') # conversion needed here because of lacking unicode_literals on python2
    223223        # Convert 1 or 0 to True or False
    224224        elif value in (1, 0) and field and field.get_internal_type() in ('BooleanField', 'NullBooleanField'):
    225225            value = bool(value)
Back to Top