# HG changeset patch # User Sylvain Thénault # Date 1309526805 -7200 # Node ID d332ecfc224a5f042f9e97bf337a839b369f6326 # Parent 01b49ec8fe80facd1e3af737b033639ca07857bb [range facet] refactor to ease overriding, possible_values raise DontUpdateFacet (not handled by js actually) diff -r 01b49ec8fe80 -r d332ecfc224a web/facet.py --- a/web/facet.py Fri Jul 01 15:26:44 2011 +0200 +++ b/web/facet.py Fri Jul 01 15:26:45 2011 +0200 @@ -1018,15 +1018,19 @@ # when a value is equal to one of the limit, don't add the restriction, # else we filter out NULL values implicitly if infvalue != self.infvalue(min=True): - self.rqlst.add_constant_restriction(self.filtered_variable, - self.rtype, - self.formatvalue(infvalue), - self.attrtype, '>=') + self._add_restriction(infvalue, '>=') if supvalue != self.supvalue(max=True): - self.rqlst.add_constant_restriction(self.filtered_variable, - self.rtype, - self.formatvalue(supvalue), - self.attrtype, '<=') + self._add_restriction(supvalue, '<=') + + def _add_restriction(self, operator, value): + self.select.add_constant_restriction(self.filtered_variable, + self.rtype, + self.formatvalue(value), + self.attrtype, operator) + + def possible_values(self): + # javascript don't know how to update the widget anyway + raise facet.DontUpdateFacet() class DateRangeFacet(RangeFacet):