web/facet.py
changeset 7625 ae4cb4153490
parent 7624 ce020f90fb8e
child 7626 56300bec75f8
--- a/web/facet.py	Thu Jul 07 11:33:39 2011 +0200
+++ b/web/facet.py	Thu Jul 07 11:33:55 2011 +0200
@@ -750,9 +750,13 @@
                 self._and_restriction(rel, restrvar, value.pop())
 
     def _and_restriction(self, rel, restrvar, value):
-        rrel = nodes.make_constant_restriction(restrvar, self.restr_attr,
-                                               value, self.restr_attr_type)
-        rel.parent.replace(rel, nodes.And(rel, rrel))
+        if rel is None:
+            self.select.add_constant_restriction(restrvar, self.restr_attr,
+                                                 value, self.restr_attr_type)
+        else:
+            rrel = nodes.make_constant_restriction(restrvar, self.restr_attr,
+                                                   value, self.restr_attr_type)
+            rel.parent.replace(rel, nodes.And(rel, rrel))
 
 
     @cached