web/facet.py
branchstable
changeset 5618 24cc5d495fdf
parent 5526 4fcb0c132098
child 5768 1e73a466aa69
child 5773 aae03cd19151
--- 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):