diff -r 2ee0ef069fa7 -r 2a3c1b787688 doc/book/en/devrepo/vreg.rst --- a/doc/book/en/devrepo/vreg.rst Thu Feb 02 14:33:30 2012 +0100 +++ b/doc/book/en/devrepo/vreg.rst Mon Jan 23 13:25:02 2012 +0100 @@ -1,5 +1,5 @@ -The VRegistry, selectors and application objects -================================================ +The Registry, selectors and application objects +=============================================== This chapter deals with some of the core concepts of the |cubicweb| framework which make it different from other frameworks (and maybe not easy to @@ -13,107 +13,108 @@ :ref:`VRegistryIntro` chapter. .. autodocstring:: cubicweb.cwvreg -.. autodocstring:: cubicweb.selectors +.. autodocstring:: cubicweb.predicates .. automodule:: cubicweb.appobject -Base selectors --------------- +Base predicates +--------------- -Selectors are scoring functions that are called by the registry to tell whenever -an appobject can be selected in a given context. Selector sets are for instance -the glue that tie views to the data model. Using them appropriately is an +Predicates are scoring functions that are called by the registry to tell whenever +an appobject can be selected in a given context. Predicates may be chained +together using operators to build a selector. A selector is the glue that tie +views to the data model or whatever input context. Using them appropriately is an essential part of the construction of well behaved cubes. -Of course you may have to write your own set of selectors as your needs grows and -you get familiar with the framework (see :ref:`CustomSelectors`). +Of course you may have to write your own set of predicates as your needs grows +and you get familiar with the framework (see :ref:`CustomPredicates`). -Here is a description of generic selectors provided by CubicWeb that should suit +Here is a description of generic predicates provided by CubicWeb that should suit most of your needs. -Bare selectors -~~~~~~~~~~~~~~ -Those selectors are somewhat dumb, which doesn't mean they're not (very) useful. +Bare predicates +~~~~~~~~~~~~~~~ +Those predicates are somewhat dumb, which doesn't mean they're not (very) useful. .. autoclass:: cubicweb.appobject.yes -.. autoclass:: cubicweb.selectors.match_kwargs -.. autoclass:: cubicweb.selectors.appobject_selectable -.. autoclass:: cubicweb.selectors.adaptable -.. autoclass:: cubicweb.selectors.configuration_values +.. autoclass:: cubicweb.predicates.match_kwargs +.. autoclass:: cubicweb.predicates.appobject_selectable +.. autoclass:: cubicweb.predicates.adaptable +.. autoclass:: cubicweb.predicates.configuration_values -Result set selectors +Result set predicates ~~~~~~~~~~~~~~~~~~~~~ -Those selectors are looking for a result set in the context ('rset' argument or +Those predicates are looking for a result set in the context ('rset' argument or the input context) and match or not according to its shape. Some of these -selectors have different behaviour if a particular cell of the result set is +predicates have different behaviour if a particular cell of the result set is specified using 'row' and 'col' arguments of the input context or not. -.. autoclass:: cubicweb.selectors.none_rset -.. autoclass:: cubicweb.selectors.any_rset -.. autoclass:: cubicweb.selectors.nonempty_rset -.. autoclass:: cubicweb.selectors.empty_rset -.. autoclass:: cubicweb.selectors.one_line_rset -.. autoclass:: cubicweb.selectors.multi_lines_rset -.. autoclass:: cubicweb.selectors.multi_columns_rset -.. autoclass:: cubicweb.selectors.paginated_rset -.. autoclass:: cubicweb.selectors.sorted_rset -.. autoclass:: cubicweb.selectors.one_etype_rset -.. autoclass:: cubicweb.selectors.multi_etypes_rset +.. autoclass:: cubicweb.predicates.none_rset +.. autoclass:: cubicweb.predicates.any_rset +.. autoclass:: cubicweb.predicates.nonempty_rset +.. autoclass:: cubicweb.predicates.empty_rset +.. autoclass:: cubicweb.predicates.one_line_rset +.. autoclass:: cubicweb.predicates.multi_lines_rset +.. autoclass:: cubicweb.predicates.multi_columns_rset +.. autoclass:: cubicweb.predicates.paginated_rset +.. autoclass:: cubicweb.predicates.sorted_rset +.. autoclass:: cubicweb.predicates.one_etype_rset +.. autoclass:: cubicweb.predicates.multi_etypes_rset -Entity selectors -~~~~~~~~~~~~~~~~ -Those selectors are looking for either an `entity` argument in the input context, +Entity predicates +~~~~~~~~~~~~~~~~~ +Those predicates are looking for either an `entity` argument in the input context, or entity found in the result set ('rset' argument or the input context) and match or not according to entity's (instance or class) properties. -.. autoclass:: cubicweb.selectors.non_final_entity -.. autoclass:: cubicweb.selectors.is_instance -.. autoclass:: cubicweb.selectors.score_entity -.. autoclass:: cubicweb.selectors.rql_condition -.. autoclass:: cubicweb.selectors.relation_possible -.. autoclass:: cubicweb.selectors.partial_relation_possible -.. autoclass:: cubicweb.selectors.has_related_entities -.. autoclass:: cubicweb.selectors.partial_has_related_entities -.. autoclass:: cubicweb.selectors.has_permission -.. autoclass:: cubicweb.selectors.has_add_permission -.. autoclass:: cubicweb.selectors.has_mimetype -.. autoclass:: cubicweb.selectors.is_in_state -.. autofunction:: cubicweb.selectors.on_fire_transition -.. autoclass:: cubicweb.selectors.implements +.. autoclass:: cubicweb.predicates.non_final_entity +.. autoclass:: cubicweb.predicates.is_instance +.. autoclass:: cubicweb.predicates.score_entity +.. autoclass:: cubicweb.predicates.rql_condition +.. autoclass:: cubicweb.predicates.relation_possible +.. autoclass:: cubicweb.predicates.partial_relation_possible +.. autoclass:: cubicweb.predicates.has_related_entities +.. autoclass:: cubicweb.predicates.partial_has_related_entities +.. autoclass:: cubicweb.predicates.has_permission +.. autoclass:: cubicweb.predicates.has_add_permission +.. autoclass:: cubicweb.predicates.has_mimetype +.. autoclass:: cubicweb.predicates.is_in_state +.. autofunction:: cubicweb.predicates.on_fire_transition +.. autoclass:: cubicweb.predicates.implements -Logged user selectors -~~~~~~~~~~~~~~~~~~~~~ -Those selectors are looking for properties of the user issuing the request. +Logged user predicates +~~~~~~~~~~~~~~~~~~~~~~ +Those predicates are looking for properties of the user issuing the request. -.. autoclass:: cubicweb.selectors.match_user_groups +.. autoclass:: cubicweb.predicates.match_user_groups -Web request selectors -~~~~~~~~~~~~~~~~~~~~~ -Those selectors are looking for properties of *web* request, they can not be +Web request predicates +~~~~~~~~~~~~~~~~~~~~~~ +Those predicates are looking for properties of *web* request, they can not be used on the data repository side. -.. autoclass:: cubicweb.selectors.no_cnx -.. autoclass:: cubicweb.selectors.anonymous_user -.. autoclass:: cubicweb.selectors.authenticated_user -.. autoclass:: cubicweb.selectors.match_form_params -.. autoclass:: cubicweb.selectors.match_search_state -.. autoclass:: cubicweb.selectors.match_context_prop -.. autoclass:: cubicweb.selectors.match_context -.. autoclass:: cubicweb.selectors.match_view -.. autoclass:: cubicweb.selectors.primary_view -.. autoclass:: cubicweb.selectors.contextual -.. autoclass:: cubicweb.selectors.specified_etype_implements -.. autoclass:: cubicweb.selectors.attribute_edited -.. autoclass:: cubicweb.selectors.match_transition +.. autoclass:: cubicweb.predicates.no_cnx +.. autoclass:: cubicweb.predicates.anonymous_user +.. autoclass:: cubicweb.predicates.authenticated_user +.. autoclass:: cubicweb.predicates.match_form_params +.. autoclass:: cubicweb.predicates.match_search_state +.. autoclass:: cubicweb.predicates.match_context_prop +.. autoclass:: cubicweb.predicates.match_context +.. autoclass:: cubicweb.predicates.match_view +.. autoclass:: cubicweb.predicates.primary_view +.. autoclass:: cubicweb.predicates.contextual +.. autoclass:: cubicweb.predicates.specified_etype_implements +.. autoclass:: cubicweb.predicates.attribute_edited +.. autoclass:: cubicweb.predicates.match_transition -Other selectors -~~~~~~~~~~~~~~~ -.. autoclass:: cubicweb.selectors.match_exception -.. autoclass:: cubicweb.selectors.debug_mode +Other predicates +~~~~~~~~~~~~~~~~ +.. autoclass:: cubicweb.predicates.match_exception +.. autoclass:: cubicweb.predicates.debug_mode -You'll also find some other (very) specific selectors hidden in other modules -than :mod:`cubicweb.selectors`. +You'll also find some other (very) specific predicates hidden in other modules +than :mod:`cubicweb.predicates`.