|
1 The Registry, selectors and application objects |
|
2 =============================================== |
|
3 |
|
4 This chapter deals with some of the core concepts of the |cubicweb| framework |
|
5 which make it different from other frameworks (and maybe not easy to |
|
6 grasp at a first glance). To be able to do advanced development with |
|
7 |cubicweb| you need a good understanding of what is explained below. |
|
8 |
|
9 This chapter goes deep into details. You don't have to remember them |
|
10 all but keep it in mind so you can go back there later. |
|
11 |
|
12 An overview of AppObjects, the VRegistry and Selectors is given in the |
|
13 :ref:`VRegistryIntro` chapter. |
|
14 |
|
15 .. autodocstring:: cubicweb.cwvreg |
|
16 .. autodocstring:: cubicweb.predicates |
|
17 .. automodule:: cubicweb.appobject |
|
18 |
|
19 Base predicates |
|
20 --------------- |
|
21 |
|
22 Predicates are scoring functions that are called by the registry to tell whenever |
|
23 an appobject can be selected in a given context. Predicates may be chained |
|
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 |
|
26 essential part of the construction of well behaved cubes. |
|
27 |
|
28 Of course you may have to write your own set of predicates as your needs grows |
|
29 and you get familiar with the framework (see :ref:`CustomPredicates`). |
|
30 |
|
31 Here is a description of generic predicates provided by CubicWeb that should suit |
|
32 most of your needs. |
|
33 |
|
34 Bare predicates |
|
35 ~~~~~~~~~~~~~~~ |
|
36 Those predicates are somewhat dumb, which doesn't mean they're not (very) useful. |
|
37 |
|
38 .. autoclass:: cubicweb.appobject.yes |
|
39 .. autoclass:: cubicweb.predicates.match_kwargs |
|
40 .. autoclass:: cubicweb.predicates.appobject_selectable |
|
41 .. autoclass:: cubicweb.predicates.adaptable |
|
42 .. autoclass:: cubicweb.predicates.configuration_values |
|
43 |
|
44 |
|
45 Result set predicates |
|
46 ~~~~~~~~~~~~~~~~~~~~~ |
|
47 Those predicates are looking for a result set in the context ('rset' argument or |
|
48 the input context) and match or not according to its shape. Some of these |
|
49 predicates have different behaviour if a particular cell of the result set is |
|
50 specified using 'row' and 'col' arguments of the input context or not. |
|
51 |
|
52 .. autoclass:: cubicweb.predicates.none_rset |
|
53 .. autoclass:: cubicweb.predicates.any_rset |
|
54 .. autoclass:: cubicweb.predicates.nonempty_rset |
|
55 .. autoclass:: cubicweb.predicates.empty_rset |
|
56 .. autoclass:: cubicweb.predicates.one_line_rset |
|
57 .. autoclass:: cubicweb.predicates.multi_lines_rset |
|
58 .. autoclass:: cubicweb.predicates.multi_columns_rset |
|
59 .. autoclass:: cubicweb.predicates.paginated_rset |
|
60 .. autoclass:: cubicweb.predicates.sorted_rset |
|
61 .. autoclass:: cubicweb.predicates.one_etype_rset |
|
62 .. autoclass:: cubicweb.predicates.multi_etypes_rset |
|
63 |
|
64 |
|
65 Entity predicates |
|
66 ~~~~~~~~~~~~~~~~~ |
|
67 Those predicates are looking for either an `entity` argument in the input context, |
|
68 or entity found in the result set ('rset' argument or the input context) and |
|
69 match or not according to entity's (instance or class) properties. |
|
70 |
|
71 .. autoclass:: cubicweb.predicates.non_final_entity |
|
72 .. autoclass:: cubicweb.predicates.is_instance |
|
73 .. autoclass:: cubicweb.predicates.score_entity |
|
74 .. autoclass:: cubicweb.predicates.rql_condition |
|
75 .. autoclass:: cubicweb.predicates.relation_possible |
|
76 .. autoclass:: cubicweb.predicates.partial_relation_possible |
|
77 .. autoclass:: cubicweb.predicates.has_related_entities |
|
78 .. autoclass:: cubicweb.predicates.partial_has_related_entities |
|
79 .. autoclass:: cubicweb.predicates.has_permission |
|
80 .. autoclass:: cubicweb.predicates.has_add_permission |
|
81 .. autoclass:: cubicweb.predicates.has_mimetype |
|
82 .. autoclass:: cubicweb.predicates.is_in_state |
|
83 .. autofunction:: cubicweb.predicates.on_fire_transition |
|
84 |
|
85 |
|
86 Logged user predicates |
|
87 ~~~~~~~~~~~~~~~~~~~~~~ |
|
88 Those predicates are looking for properties of the user issuing the request. |
|
89 |
|
90 .. autoclass:: cubicweb.predicates.match_user_groups |
|
91 |
|
92 |
|
93 Web request predicates |
|
94 ~~~~~~~~~~~~~~~~~~~~~~ |
|
95 Those predicates are looking for properties of *web* request, they can not be |
|
96 used on the data repository side. |
|
97 |
|
98 .. autoclass:: cubicweb.predicates.no_cnx |
|
99 .. autoclass:: cubicweb.predicates.anonymous_user |
|
100 .. autoclass:: cubicweb.predicates.authenticated_user |
|
101 .. autoclass:: cubicweb.predicates.match_form_params |
|
102 .. autoclass:: cubicweb.predicates.match_search_state |
|
103 .. autoclass:: cubicweb.predicates.match_context_prop |
|
104 .. autoclass:: cubicweb.predicates.match_context |
|
105 .. autoclass:: cubicweb.predicates.match_view |
|
106 .. autoclass:: cubicweb.predicates.primary_view |
|
107 .. autoclass:: cubicweb.predicates.contextual |
|
108 .. autoclass:: cubicweb.predicates.specified_etype_implements |
|
109 .. autoclass:: cubicweb.predicates.attribute_edited |
|
110 .. autoclass:: cubicweb.predicates.match_transition |
|
111 |
|
112 |
|
113 Other predicates |
|
114 ~~~~~~~~~~~~~~~~ |
|
115 .. autoclass:: cubicweb.predicates.match_exception |
|
116 .. autoclass:: cubicweb.predicates.debug_mode |
|
117 |
|
118 You'll also find some other (very) specific predicates hidden in other modules |
|
119 than :mod:`cubicweb.predicates`. |