web/facet.py
changeset 5238 31c12863fd9d
parent 5174 78438ad513ca
parent 5225 9ff0dee81eb2
child 5423 e15abfdcce38
equal deleted inserted replaced
5237:10dd0dd78778 5238:31c12863fd9d
   380                 self.exception('error while getting vocabulary for %s, rql: %s',
   380                 self.exception('error while getting vocabulary for %s, rql: %s',
   381                                self, rqlst.as_string())
   381                                self, rqlst.as_string())
   382                 return ()
   382                 return ()
   383         finally:
   383         finally:
   384             rqlst.recover()
   384             rqlst.recover()
   385         return self.rset_vocabulary(rset)
   385         # don't call rset_vocabulary on empty result set, it may be an empty
       
   386         # *list* (see rqlexec implementation)
       
   387         return rset and self.rset_vocabulary(rset)
   386 
   388 
   387     def possible_values(self):
   389     def possible_values(self):
   388         """return a list of possible values (as string since it's used to
   390         """return a list of possible values (as string since it's used to
   389         compare to a form value in javascript) for this facet
   391         compare to a form value in javascript) for this facet
   390         """
   392         """
   469                 self.exception('error while getting vocabulary for %s, rql: %s',
   471                 self.exception('error while getting vocabulary for %s, rql: %s',
   470                                self, rqlst.as_string())
   472                                self, rqlst.as_string())
   471                 return ()
   473                 return ()
   472         finally:
   474         finally:
   473             rqlst.recover()
   475             rqlst.recover()
   474         return self.rset_vocabulary(rset)
   476         # don't call rset_vocabulary on empty result set, it may be an empty
       
   477         # *list* (see rqlexec implementation)
       
   478         return rset and self.rset_vocabulary(rset)
   475 
   479 
   476     def rset_vocabulary(self, rset):
   480     def rset_vocabulary(self, rset):
   477         _ = self._cw._
   481         _ = self._cw._
   478         return [(_(value), value) for value, in rset]
   482         return [(_(value), value) for value, in rset]
   479 
   483