web/facet.py
branchstable
changeset 7879 9aae456abab5
parent 7874 be04706eacc9
child 7943 ad0581296e2c
child 7944 1faa8edb5ae3
equal deleted inserted replaced
7874:be04706eacc9 7879:9aae456abab5
    80     return req.vreg['facets'].object_by_id(facetid, req, select=select,
    80     return req.vreg['facets'].object_by_id(facetid, req, select=select,
    81                                            filtered_variable=filtered_variable)
    81                                            filtered_variable=filtered_variable)
    82 
    82 
    83 @deprecated('[3.13] filter_hiddens moved to cubicweb.web.views.facets with '
    83 @deprecated('[3.13] filter_hiddens moved to cubicweb.web.views.facets with '
    84             'slightly modified prototype')
    84             'slightly modified prototype')
    85 def filter_hiddens(w, **kwargs):
    85 def filter_hiddens(w, baserql, **kwargs):
    86     from cubicweb.web.views.facets import filter_hiddens
    86     from cubicweb.web.views.facets import filter_hiddens
    87     return filter_hiddens(w, wdgs=kwargs.pop('facets'))
    87     return filter_hiddens(w, baserql, wdgs=kwargs.pop('facets'), **kwargs)
    88 
    88 
    89 
    89 
    90 ## rqlst manipulation functions used by facets ################################
    90 ## rqlst manipulation functions used by facets ################################
    91 
    91 
    92 def init_facets(rset, select, mainvar=None):
    92 def init_facets(rset, select, mainvar=None):
   500 
   500 
   501 
   501 
   502 
   502 
   503 class RelationFacet(VocabularyFacet):
   503 class RelationFacet(VocabularyFacet):
   504     """Base facet to filter some entities according to other entities to which
   504     """Base facet to filter some entities according to other entities to which
   505     they are related. Create concret facet by inheriting from this class an then
   505     they are related. Create concrete facet by inheriting from this class an then
   506     configuring it by setting class attribute described below.
   506     configuring it by setting class attribute described below.
   507 
   507 
   508     The relation is defined by the `rtype` and `role` attributes.
   508     The relation is defined by the `rtype` and `role` attributes.
   509 
   509 
   510     The `no_relation` boolean flag tells if a special 'no relation' value should be
   510     The `no_relation` boolean flag tells if a special 'no relation' value should be
   749             self._and_restriction(rel, restrvar, value.pop())
   749             self._and_restriction(rel, restrvar, value.pop())
   750             while value:
   750             while value:
   751                 restrvar, rtrel = _make_relation(self.select, self.filtered_variable,
   751                 restrvar, rtrel = _make_relation(self.select, self.filtered_variable,
   752                                                  self.rtype, self.role)
   752                                                  self.rtype, self.role)
   753                 if rel is None:
   753                 if rel is None:
   754                     select.add_restriction(rtrel)
   754                     self.select.add_restriction(rtrel)
   755                 else:
   755                 else:
   756                     rel.parent.replace(rel, nodes.And(rel, rtrel))
   756                     rel.parent.replace(rel, nodes.And(rel, rtrel))
   757                 self._and_restriction(rel, restrvar, value.pop())
   757                 self._and_restriction(rel, restrvar, value.pop())
   758 
   758 
   759     def _and_restriction(self, rel, restrvar, value):
   759     def _and_restriction(self, rel, restrvar, value):