11 |
11 |
12 An overview of AppObjects, the VRegistry and Selectors is given in the |
12 An overview of AppObjects, the VRegistry and Selectors is given in the |
13 :ref:`VRegistryIntro` chapter. |
13 :ref:`VRegistryIntro` chapter. |
14 |
14 |
15 .. autodocstring:: cubicweb.cwvreg |
15 .. autodocstring:: cubicweb.cwvreg |
16 .. autodocstring:: cubicweb.selectors |
16 .. autodocstring:: cubicweb.predicates |
17 .. automodule:: cubicweb.appobject |
17 .. automodule:: cubicweb.appobject |
18 |
18 |
19 Base selectors |
19 Base predicates |
20 -------------- |
20 --------------- |
21 |
21 |
22 Selectors are scoring functions that are called by the registry to tell whenever |
22 Predicates are scoring functions that are called by the registry to tell whenever |
23 an appobject can be selected in a given context. Selector sets are for instance |
23 an appobject can be selected in a given context. Predicates may be chained |
24 the glue that tie views to the data model. Using them appropriately is an |
24 together using operators to build a selector. A selector is the glue that tie |
|
25 views to the data model or whatever input context. Using them appropriately is an |
25 essential part of the construction of well behaved cubes. |
26 essential part of the construction of well behaved cubes. |
26 |
27 |
27 Of course you may have to write your own set of selectors as your needs grows and |
28 Of course you may have to write your own set of predicates as your needs grows |
28 you get familiar with the framework (see :ref:`CustomSelectors`). |
29 and you get familiar with the framework (see :ref:`CustomPredicates`). |
29 |
30 |
30 Here is a description of generic selectors provided by CubicWeb that should suit |
31 Here is a description of generic predicates provided by CubicWeb that should suit |
31 most of your needs. |
32 most of your needs. |
32 |
33 |
33 Bare selectors |
34 Bare predicates |
34 ~~~~~~~~~~~~~~ |
35 ~~~~~~~~~~~~~~~ |
35 Those selectors are somewhat dumb, which doesn't mean they're not (very) useful. |
36 Those predicates are somewhat dumb, which doesn't mean they're not (very) useful. |
36 |
37 |
37 .. autoclass:: cubicweb.appobject.yes |
38 .. autoclass:: cubicweb.appobject.yes |
38 .. autoclass:: cubicweb.selectors.match_kwargs |
39 .. autoclass:: cubicweb.predicates.match_kwargs |
39 .. autoclass:: cubicweb.selectors.appobject_selectable |
40 .. autoclass:: cubicweb.predicates.appobject_selectable |
40 .. autoclass:: cubicweb.selectors.adaptable |
41 .. autoclass:: cubicweb.predicates.adaptable |
41 .. autoclass:: cubicweb.selectors.configuration_values |
42 .. autoclass:: cubicweb.predicates.configuration_values |
42 |
43 |
43 |
44 |
44 Result set selectors |
45 Result set predicates |
45 ~~~~~~~~~~~~~~~~~~~~~ |
46 ~~~~~~~~~~~~~~~~~~~~~ |
46 Those selectors are looking for a result set in the context ('rset' argument or |
47 Those predicates are looking for a result set in the context ('rset' argument or |
47 the input context) and match or not according to its shape. Some of these |
48 the input context) and match or not according to its shape. Some of these |
48 selectors have different behaviour if a particular cell of the result set is |
49 predicates have different behaviour if a particular cell of the result set is |
49 specified using 'row' and 'col' arguments of the input context or not. |
50 specified using 'row' and 'col' arguments of the input context or not. |
50 |
51 |
51 .. autoclass:: cubicweb.selectors.none_rset |
52 .. autoclass:: cubicweb.predicates.none_rset |
52 .. autoclass:: cubicweb.selectors.any_rset |
53 .. autoclass:: cubicweb.predicates.any_rset |
53 .. autoclass:: cubicweb.selectors.nonempty_rset |
54 .. autoclass:: cubicweb.predicates.nonempty_rset |
54 .. autoclass:: cubicweb.selectors.empty_rset |
55 .. autoclass:: cubicweb.predicates.empty_rset |
55 .. autoclass:: cubicweb.selectors.one_line_rset |
56 .. autoclass:: cubicweb.predicates.one_line_rset |
56 .. autoclass:: cubicweb.selectors.multi_lines_rset |
57 .. autoclass:: cubicweb.predicates.multi_lines_rset |
57 .. autoclass:: cubicweb.selectors.multi_columns_rset |
58 .. autoclass:: cubicweb.predicates.multi_columns_rset |
58 .. autoclass:: cubicweb.selectors.paginated_rset |
59 .. autoclass:: cubicweb.predicates.paginated_rset |
59 .. autoclass:: cubicweb.selectors.sorted_rset |
60 .. autoclass:: cubicweb.predicates.sorted_rset |
60 .. autoclass:: cubicweb.selectors.one_etype_rset |
61 .. autoclass:: cubicweb.predicates.one_etype_rset |
61 .. autoclass:: cubicweb.selectors.multi_etypes_rset |
62 .. autoclass:: cubicweb.predicates.multi_etypes_rset |
62 |
63 |
63 |
64 |
64 Entity selectors |
65 Entity predicates |
65 ~~~~~~~~~~~~~~~~ |
66 ~~~~~~~~~~~~~~~~~ |
66 Those selectors are looking for either an `entity` argument in the input context, |
67 Those predicates are looking for either an `entity` argument in the input context, |
67 or entity found in the result set ('rset' argument or the input context) and |
68 or entity found in the result set ('rset' argument or the input context) and |
68 match or not according to entity's (instance or class) properties. |
69 match or not according to entity's (instance or class) properties. |
69 |
70 |
70 .. autoclass:: cubicweb.selectors.non_final_entity |
71 .. autoclass:: cubicweb.predicates.non_final_entity |
71 .. autoclass:: cubicweb.selectors.is_instance |
72 .. autoclass:: cubicweb.predicates.is_instance |
72 .. autoclass:: cubicweb.selectors.score_entity |
73 .. autoclass:: cubicweb.predicates.score_entity |
73 .. autoclass:: cubicweb.selectors.rql_condition |
74 .. autoclass:: cubicweb.predicates.rql_condition |
74 .. autoclass:: cubicweb.selectors.relation_possible |
75 .. autoclass:: cubicweb.predicates.relation_possible |
75 .. autoclass:: cubicweb.selectors.partial_relation_possible |
76 .. autoclass:: cubicweb.predicates.partial_relation_possible |
76 .. autoclass:: cubicweb.selectors.has_related_entities |
77 .. autoclass:: cubicweb.predicates.has_related_entities |
77 .. autoclass:: cubicweb.selectors.partial_has_related_entities |
78 .. autoclass:: cubicweb.predicates.partial_has_related_entities |
78 .. autoclass:: cubicweb.selectors.has_permission |
79 .. autoclass:: cubicweb.predicates.has_permission |
79 .. autoclass:: cubicweb.selectors.has_add_permission |
80 .. autoclass:: cubicweb.predicates.has_add_permission |
80 .. autoclass:: cubicweb.selectors.has_mimetype |
81 .. autoclass:: cubicweb.predicates.has_mimetype |
81 .. autoclass:: cubicweb.selectors.is_in_state |
82 .. autoclass:: cubicweb.predicates.is_in_state |
82 .. autofunction:: cubicweb.selectors.on_fire_transition |
83 .. autofunction:: cubicweb.predicates.on_fire_transition |
83 .. autoclass:: cubicweb.selectors.implements |
84 .. autoclass:: cubicweb.predicates.implements |
84 |
85 |
85 |
86 |
86 Logged user selectors |
87 Logged user predicates |
87 ~~~~~~~~~~~~~~~~~~~~~ |
88 ~~~~~~~~~~~~~~~~~~~~~~ |
88 Those selectors are looking for properties of the user issuing the request. |
89 Those predicates are looking for properties of the user issuing the request. |
89 |
90 |
90 .. autoclass:: cubicweb.selectors.match_user_groups |
91 .. autoclass:: cubicweb.predicates.match_user_groups |
91 |
92 |
92 |
93 |
93 Web request selectors |
94 Web request predicates |
94 ~~~~~~~~~~~~~~~~~~~~~ |
95 ~~~~~~~~~~~~~~~~~~~~~~ |
95 Those selectors are looking for properties of *web* request, they can not be |
96 Those predicates are looking for properties of *web* request, they can not be |
96 used on the data repository side. |
97 used on the data repository side. |
97 |
98 |
98 .. autoclass:: cubicweb.selectors.no_cnx |
99 .. autoclass:: cubicweb.predicates.no_cnx |
99 .. autoclass:: cubicweb.selectors.anonymous_user |
100 .. autoclass:: cubicweb.predicates.anonymous_user |
100 .. autoclass:: cubicweb.selectors.authenticated_user |
101 .. autoclass:: cubicweb.predicates.authenticated_user |
101 .. autoclass:: cubicweb.selectors.match_form_params |
102 .. autoclass:: cubicweb.predicates.match_form_params |
102 .. autoclass:: cubicweb.selectors.match_search_state |
103 .. autoclass:: cubicweb.predicates.match_search_state |
103 .. autoclass:: cubicweb.selectors.match_context_prop |
104 .. autoclass:: cubicweb.predicates.match_context_prop |
104 .. autoclass:: cubicweb.selectors.match_context |
105 .. autoclass:: cubicweb.predicates.match_context |
105 .. autoclass:: cubicweb.selectors.match_view |
106 .. autoclass:: cubicweb.predicates.match_view |
106 .. autoclass:: cubicweb.selectors.primary_view |
107 .. autoclass:: cubicweb.predicates.primary_view |
107 .. autoclass:: cubicweb.selectors.contextual |
108 .. autoclass:: cubicweb.predicates.contextual |
108 .. autoclass:: cubicweb.selectors.specified_etype_implements |
109 .. autoclass:: cubicweb.predicates.specified_etype_implements |
109 .. autoclass:: cubicweb.selectors.attribute_edited |
110 .. autoclass:: cubicweb.predicates.attribute_edited |
110 .. autoclass:: cubicweb.selectors.match_transition |
111 .. autoclass:: cubicweb.predicates.match_transition |
111 |
112 |
112 |
113 |
113 Other selectors |
114 Other predicates |
114 ~~~~~~~~~~~~~~~ |
115 ~~~~~~~~~~~~~~~~ |
115 .. autoclass:: cubicweb.selectors.match_exception |
116 .. autoclass:: cubicweb.predicates.match_exception |
116 .. autoclass:: cubicweb.selectors.debug_mode |
117 .. autoclass:: cubicweb.predicates.debug_mode |
117 |
118 |
118 You'll also find some other (very) specific selectors hidden in other modules |
119 You'll also find some other (very) specific predicates hidden in other modules |
119 than :mod:`cubicweb.selectors`. |
120 than :mod:`cubicweb.predicates`. |