diff options
Diffstat (limited to 'sqlparse/compat.py')
-rw-r--r-- | sqlparse/compat.py | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/sqlparse/compat.py b/sqlparse/compat.py index 0226a00..0defd86 100644 --- a/sqlparse/compat.py +++ b/sqlparse/compat.py @@ -25,6 +25,10 @@ if PY3: return str(s) + def unicode_compatible(cls): + return cls + + text_type = str string_types = (str,) from io import StringIO @@ -39,6 +43,12 @@ elif PY2: return unicode(s, encoding) + def unicode_compatible(cls): + cls.__unicode__ = cls.__str__ + cls.__str__ = lambda x: x.__unicode__().encode('utf-8') + return cls + + text_type = unicode string_types = (basestring,) from StringIO import StringIO |