[rql2sql] Use string_type instead of unicode for py3k support
authorSylvain Thénault <sylvain.thenault@logilab.fr>
Fri, 15 Sep 2017 17:01:04 +0200
changeset 12233 62918203b9fc
parent 12232 24393ce335f5
child 12234 14fdd5888cbb
[rql2sql] Use string_type instead of unicode for py3k support
cubicweb/server/sources/rql2sql.py
--- a/cubicweb/server/sources/rql2sql.py	Wed Nov 29 17:08:05 2017 +0100
+++ b/cubicweb/server/sources/rql2sql.py	Fri Sep 15 17:01:04 2017 +0200
@@ -49,7 +49,7 @@
 
 import threading
 
-from six import PY2
+from six import PY2, text_type
 from six.moves import range
 
 from logilab.database import FunctionDescr, SQL_FUNCTIONS_REGISTRY
@@ -1511,7 +1511,7 @@
             return self.keyword_map[value]()
         if constant.type == 'Substitute':
             _id = value
-            if PY2 and isinstance(_id, unicode):
+            if PY2 and isinstance(_id, text_type):
                 _id = _id.encode()
         else:
             _id = str(id(constant)).replace('-', '', 1)