[facet] we must add type restriction for attribute facets as well stable
authorSylvain Thénault <sylvain.thenault@logilab.fr>
Tue, 01 Jun 2010 12:21:44 +0200
branchstable
changeset 5618 24cc5d495fdf
parent 5617 f0bc8f5ddee2
child 5619 a2c9a55b5a9d
[facet] we must add type restriction for attribute facets as well
web/facet.py
--- a/web/facet.py	Tue Jun 01 12:21:03 2010 +0200
+++ b/web/facet.py	Tue Jun 01 12:21:44 2010 +0200
@@ -157,6 +157,10 @@
     if rqlst.groupby:
         rqlst.add_group_var(newvar)
     rqlst.add_selected(newvar)
+    # add is restriction if necessary
+    if mainvar.stinfo['typerel'] is None:
+        etypes = frozenset(sol[mainvar.name] for sol in rqlst.solutions)
+        rqlst.add_type_restriction(mainvar, etypes)
     return newvar
 
 def _remove_relation(rqlst, rel, var):
@@ -210,10 +214,6 @@
         _set_orderby(rqlst, attrvar, sortasc, sortfuncname)
     # add attribute variable to selection
     rqlst.add_selected(attrvar)
-    # add is restriction if necessary
-    if mainvar.stinfo['typerel'] is None:
-        etypes = frozenset(sol[mainvar.name] for sol in rqlst.solutions)
-        rqlst.add_type_restriction(mainvar, etypes)
     return var
 
 def _cleanup_rqlst(rqlst, mainvar):