cubicweb/rset.py
changeset 11868 d5181d7f1389
parent 11767 432f87a63057
child 11870 3a84a79c4ed5
equal deleted inserted replaced
11867:c714e55fbce1 11868:d5181d7f1389
    18 """The `ResultSet` class which is returned as result of an rql query"""
    18 """The `ResultSet` class which is returned as result of an rql query"""
    19 
    19 
    20 
    20 
    21 from warnings import warn
    21 from warnings import warn
    22 
    22 
    23 from six import PY3
    23 from six import PY3, text_type
    24 from six.moves import range
    24 from six.moves import range
    25 
    25 
    26 from logilab.common import nullobject
    26 from logilab.common import nullobject
    27 from logilab.common.decorators import cached, clear_cache, copy_cache
    27 from logilab.common.decorators import cached, clear_cache, copy_cache
    28 from rql import nodes, stmts
    28 from rql import nodes, stmts
   373         rqlstr = self.syntax_tree().as_string(kwargs=self.args)
   373         rqlstr = self.syntax_tree().as_string(kwargs=self.args)
   374         if PY3:
   374         if PY3:
   375             return rqlstr
   375             return rqlstr
   376         # sounds like we get encoded or unicode string due to a bug in as_string
   376         # sounds like we get encoded or unicode string due to a bug in as_string
   377         if not encoded:
   377         if not encoded:
   378             if isinstance(rqlstr, unicode):
   378             if isinstance(rqlstr, text_type):
   379                 return rqlstr
   379                 return rqlstr
   380             return unicode(rqlstr, encoding)
   380             return text_type(rqlstr, encoding)
   381         else:
   381         else:
   382             if isinstance(rqlstr, unicode):
   382             if isinstance(rqlstr, text_type):
   383                 return rqlstr.encode(encoding)
   383                 return rqlstr.encode(encoding)
   384             return rqlstr
   384             return rqlstr
   385 
   385 
   386     # client helper methods ###################################################
   386     # client helper methods ###################################################
   387 
   387