[facets] proper fix for #1625112: we should rather call unicode() as we always manipulate string as unicode internally stable
authorSylvain Thénault <sylvain.thenault@logilab.fr>
Fri, 29 Apr 2011 09:33:30 +0200
branchstable
changeset 7279 eb73ce823622
parent 7270 5a1e9b90b5c4
child 7280 571b29842ef1
[facets] proper fix for #1625112: we should rather call unicode() as we always manipulate string as unicode internally
web/facet.py
--- a/web/facet.py	Thu Apr 28 15:29:21 2011 +0200
+++ b/web/facet.py	Fri Apr 29 09:33:30 2011 +0200
@@ -451,11 +451,6 @@
         return False
 
 
-def encode(obj, encoding):
-    if isinstance(obj, unicode):
-        return obj.encode(encoding)
-    return unicode(obj).encode(encoding)
-
 class RelationFacet(VocabularyFacet):
     """Base facet to filter some entities according to other entities to which
     they are related. Create concret facet by inheriting from this class an then
@@ -610,8 +605,7 @@
                 insert_attr_select_relation(
                     rqlst, self.filtered_variable, self.rtype, self.role, self.target_attr,
                     select_target_entity=False)
-            encoding = self._cw.encoding
-            values = [encode(x, encoding) for x, in self.rqlexec(rqlst.as_string())]
+            values = [unicode(x) for x, in self.rqlexec(rqlst.as_string())]
         except:
             self.exception('while computing values for %s', self)
             return []