web/facet.py
branchstable
changeset 5526 4fcb0c132098
parent 5426 0d4853a6e5ee
child 5618 24cc5d495fdf
equal deleted inserted replaced
5525:c4eee9921e19 5526:4fcb0c132098
   465 class AttributeFacet(RelationFacet):
   465 class AttributeFacet(RelationFacet):
   466     # attribute type
   466     # attribute type
   467     attrtype = 'String'
   467     attrtype = 'String'
   468     # type of comparison: default is an exact match on the attribute value
   468     # type of comparison: default is an exact match on the attribute value
   469     comparator = '=' # could be '<', '<=', '>', '>='
   469     comparator = '=' # could be '<', '<=', '>', '>='
       
   470     i18nable = True
   470 
   471 
   471     def vocabulary(self):
   472     def vocabulary(self):
   472         """return vocabulary for this facet, eg a list of 2-uple (label, value)
   473         """return vocabulary for this facet, eg a list of 2-uple (label, value)
   473         """
   474         """
   474         rqlst = self.rqlst
   475         rqlst = self.rqlst
   489         # don't call rset_vocabulary on empty result set, it may be an empty
   490         # don't call rset_vocabulary on empty result set, it may be an empty
   490         # *list* (see rqlexec implementation)
   491         # *list* (see rqlexec implementation)
   491         return rset and self.rset_vocabulary(rset)
   492         return rset and self.rset_vocabulary(rset)
   492 
   493 
   493     def rset_vocabulary(self, rset):
   494     def rset_vocabulary(self, rset):
   494         _ = self._cw._
   495         if self.i18nable:
       
   496             _ = self._cw._
       
   497         else:
       
   498             _ = unicode
   495         return [(_(value), value) for value, in rset]
   499         return [(_(value), value) for value, in rset]
   496 
   500 
   497     def support_and(self):
   501     def support_and(self):
   498         return False
   502         return False
   499 
   503