equal
deleted
inserted
replaced
1 """contains utility functions and some visual component to restrict results of |
1 """contains utility functions and some visual component to restrict results of |
2 a search |
2 a search |
3 |
3 |
4 :organization: Logilab |
4 :organization: Logilab |
5 :copyright: 2008 LOGILAB S.A. (Paris, FRANCE), all rights reserved. |
5 :copyright: 2008-2009 LOGILAB S.A. (Paris, FRANCE), all rights reserved. |
6 :contact: http://www.logilab.fr/ -- mailto:contact@logilab.fr |
6 :contact: http://www.logilab.fr/ -- mailto:contact@logilab.fr |
7 """ |
7 """ |
8 __docformat__ = "restructuredtext en" |
8 __docformat__ = "restructuredtext en" |
9 |
9 |
10 from itertools import chain |
10 from itertools import chain |
17 from logilab.common.compat import all |
17 from logilab.common.compat import all |
18 |
18 |
19 from rql import parse, nodes |
19 from rql import parse, nodes |
20 |
20 |
21 from cubicweb import Unauthorized, typed_eid |
21 from cubicweb import Unauthorized, typed_eid |
22 from cubicweb.common.selectors import contextprop_selector, one_has_relation_selector |
22 from cubicweb.common.selectors import match_context_prop, one_has_relation |
23 from cubicweb.common.registerers import priority_registerer |
23 from cubicweb.common.registerers import priority_registerer |
24 from cubicweb.common.appobject import AppRsetObject |
24 from cubicweb.common.appobject import AppRsetObject |
25 from cubicweb.common.utils import AcceptMixIn |
25 from cubicweb.common.utils import AcceptMixIn |
26 from cubicweb.web.htmlwidgets import HTMLWidget |
26 from cubicweb.web.htmlwidgets import HTMLWidget |
27 |
27 |
330 except Unauthorized: |
330 except Unauthorized: |
331 return [] |
331 return [] |
332 |
332 |
333 |
333 |
334 class RelationFacet(VocabularyFacet): |
334 class RelationFacet(VocabularyFacet): |
335 __selectors__ = (one_has_relation_selector, contextprop_selector) |
335 __selectors__ = (one_has_relation, match_context_prop) |
336 # class attributes to configure the relation facet |
336 # class attributes to configure the relation facet |
337 rtype = None |
337 rtype = None |
338 role = 'subject' |
338 role = 'subject' |
339 target_attr = 'eid' |
339 target_attr = 'eid' |
340 # set this to a stored procedure name if you want to sort on the result of |
340 # set this to a stored procedure name if you want to sort on the result of |