[facet] with rql path facet rel may be None, handle it
authorSylvain Thénault <sylvain.thenault@logilab.fr>
Thu, 07 Jul 2011 11:33:55 +0200
changeset 7625 ae4cb4153490
parent 7624 ce020f90fb8e
child 7626 56300bec75f8
[facet] with rql path facet rel may be None, handle it
web/facet.py
--- 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