web/views/facets.py
branchtls-sprint
changeset 742 99115e029dca
parent 692 800592b8d39b
child 758 0c0dfd33a76d
--- a/web/views/facets.py	Wed Feb 18 00:48:24 2009 +0100
+++ b/web/views/facets.py	Wed Feb 18 01:21:25 2009 +0100
@@ -10,13 +10,15 @@
 
 from logilab.mtconverter import html_escape
 
+from cubicweb.vregistry import objectify_selector
 from cubicweb.selectors import (chainfirst, chainall, non_final_entity,
                                 two_lines_rset, match_context_prop,
-                                yes, one_has_relation)
+                                yes, relation_possible)
 from cubicweb.web.box import BoxTemplate
 from cubicweb.web.facet import (AbstractFacet, VocabularyFacet, FacetStringWidget,
                              RelationFacet, prepare_facets_rqlst, filter_hiddens)
 
+@objectify_selector
 def contextview_selector(cls, req, rset, row=None, col=None, view=None,
                          **kwargs):
     if view and getattr(view, 'filter_box_context_info', lambda: None)():
@@ -27,8 +29,9 @@
 class FilterBox(BoxTemplate):
     """filter results of a query"""
     id = 'filter_box'
-    __selectors__ = ((non_final_entity() & two_lines_rset) | contextview_selector,
-                     match_context_prop)
+    __select__ = (((non_final_entity() & two_lines_rset())
+                   | contextview_selector
+                   ) & match_context_prop)
     context = 'left'
     title = _('boxes_filter_box')
     visible = True # functionality provided by the search box by default
@@ -128,7 +131,7 @@
 # inherit from RelationFacet to benefit from its possible_values implementation
 class ETypeFacet(RelationFacet):
     id = 'etype-facet'
-    __selectors__ = (yes,)
+    __select__ = yes()
     order = 1
     rtype = 'is'
     target_attr = 'name'
@@ -152,7 +155,7 @@
 
 
 class HasTextFacet(AbstractFacet):
-    __selectors__ = (one_has_relation, match_context_prop)
+    __select__ = relation_possible('has_text', 'subject') & match_context_prop()
     id = 'has_text-facet'
     rtype = 'has_text'
     role = 'subject'