fix table view facet retreival, necessary since 95ccd84c892b. Also some cleanup in facet box stable
authorSylvain Thénault <sylvain.thenault@logilab.fr>
Wed, 17 Feb 2010 16:21:34 +0100
branchstable
changeset 4616 2f296c34aec4
parent 4615 d69d7ccbe046
child 4617 9422469b8acb
fix table view facet retreival, necessary since 95ccd84c892b. Also some cleanup in facet box
web/views/facets.py
web/views/tableview.py
--- a/web/views/facets.py	Wed Feb 17 15:58:09 2010 +0100
+++ b/web/views/facets.py	Wed Feb 17 16:21:34 2010 +0100
@@ -69,9 +69,11 @@
         rset, vid, divid, paginate = self._get_context(view)
         if rset.rowcount < 2: # XXX done by selectors, though maybe necessary when rset has been hijacked
             return
-        if vid is None:
-            vid = req.form.get('vid')
-        rqlst = rset.syntax_tree().copy()
+        rqlst = self.cw_rset.syntax_tree()
+        # union not yet supported
+        if len(rqlst.children) != 1:
+            return ()
+        rqlst = rqlst.copy()
         req.vreg.rqlhelper.annotate(rqlst)
         mainvar, baserql = prepare_facets_rqlst(rqlst, rset.args)
         widgets = []
@@ -82,6 +84,8 @@
                     widgets.append(wdg)
         if not widgets:
             return
+        if vid is None:
+            vid = req.form.get('vid')
         if self.bk_linkbox_template:
             self.display_bookmark_link(rset)
         w = self.w
--- a/web/views/tableview.py	Wed Feb 17 15:58:09 2010 +0100
+++ b/web/views/tableview.py	Wed Feb 17 16:21:34 2010 +0100
@@ -33,13 +33,13 @@
         # union not yet supported
         if len(rqlst.children) != 1:
             return ()
-        rqlst.save_state()
+        rqlst = rqlst.copy()
+        self._cw.vreg.rqlhelper.annotate(rqlst)
         mainvar, baserql = prepare_facets_rqlst(rqlst, self.cw_rset.args)
         wdgs = [facet.get_widget() for facet in self._cw.vreg['facets'].poss_visible_objects(
             self._cw, rset=self.cw_rset, context='tablefilter',
             filtered_variable=mainvar)]
         wdgs = [wdg for wdg in wdgs if wdg is not None]
-        rqlst.recover()
         if wdgs:
             self._generate_form(divid, baserql, wdgs, hidden,
                                vidargs={'displaycols': displaycols,