Commit 906794ba authored by Georgios Dagkakis's avatar Georgios Dagkakis

sqltest: decode strings (to the specified encoding ot 'utf-8') only in Python3

as it is done in other places of this file
parent a5382e6f
...@@ -174,13 +174,13 @@ else: # For easy diff with original (ZSQLMethods 3.14) ...@@ -174,13 +174,13 @@ else: # For easy diff with original (ZSQLMethods 3.14)
else: else:
if not isinstance(v, StringTypes): if not isinstance(v, StringTypes):
v = str(v) v = str(v)
if isinstance(v, six.binary_type): if six.PY3 and isinstance(v, six.binary_type):
v = v.decode('utf-8') v = v.decode(self.encoding or 'UTF-8')
# The call to sql_quote__ can return something that is not # The call to sql_quote__ can return something that is not
# a native string anymore! # a native string anymore!
v = md.getitem('sql_quote__', 0)(v) v = md.getitem('sql_quote__', 0)(v)
if isinstance(v, six.binary_type): if six.PY3 and isinstance(v, six.binary_type):
v = v.decode('utf-8') v = v.decode(self.encoding or 'UTF-8')
# if v.find("\'") >= 0: v="''".(v.split("\'")) # if v.find("\'") >= 0: v="''".(v.split("\'"))
# v="'%s'" % v # v="'%s'" % v
vs.append(v) vs.append(v)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment