doc/book/en/development/vreg/selectors.rst
branchstable
changeset 5147 70181998897f
parent 5146 fe56baf63ecb
child 5148 ec0ea7366066
equal deleted inserted replaced
5146:fe56baf63ecb 5147:70181998897f
     1 Base selectors
       
     2 --------------
       
     3 
       
     4 Selectors are scoring functions that are called by the registry to tell whenever
       
     5 an appobject can be selected in a given context. Selector sets are for instance
       
     6 the glue that tie views to the data model. Using them appropriately is an
       
     7 essential part of the construction of well behaved cubes.
       
     8 
       
     9 Of course you may have to write your own set of selectors as your needs grows and
       
    10 you get familiar with the framework (see :ref:`CustomSelectors`).
       
    11 
       
    12 Here is a description of generic selectors provided by CubicWeb that should suit
       
    13 most of your needs.
       
    14 
       
    15 Bare selectors
       
    16 ~~~~~~~~~~~~~~
       
    17 Those selectors are somewhat dumb, which doesn't mean they're not (very) useful.
       
    18 
       
    19 .. autoclass:: cubicweb.appobject.yes
       
    20 .. autoclass:: cubicweb.selectors.match_kwargs
       
    21 .. autoclass:: cubicweb.selectors.appobject_selectable
       
    22 
       
    23 
       
    24 Result set selectors
       
    25 ~~~~~~~~~~~~~~~~~~~~~
       
    26 Those selectors are looking for a result set in the context ('rset' argument or
       
    27 the input context) and match or not according to its shape. Some of these
       
    28 selectors have different behaviour if a particular cell of the result set is
       
    29 specified using 'row' and 'col' arguments of the input context or not.
       
    30 
       
    31 .. autoclass:: cubicweb.selectors.none_rset
       
    32 .. autoclass:: cubicweb.selectors.any_rset
       
    33 .. autoclass:: cubicweb.selectors.nonempty_rset
       
    34 .. autoclass:: cubicweb.selectors.empty_rset
       
    35 .. autoclass:: cubicweb.selectors.one_line_rset
       
    36 .. autoclass:: cubicweb.selectors.multi_lines_rset
       
    37 .. autoclass:: cubicweb.selectors.multi_columns_rset
       
    38 .. autoclass:: cubicweb.selectors.paginated_rset
       
    39 .. autoclass:: cubicweb.selectors.sorted_rset
       
    40 .. autoclass:: cubicweb.selectors.one_etype_rset
       
    41 .. autoclass:: cubicweb.selectors.multi_etypes_rset
       
    42 
       
    43 
       
    44 Entity selectors
       
    45 ~~~~~~~~~~~~~~~~
       
    46 Those selectors are looking for either an `entity` argument in the input context,
       
    47 or entity found in the result set ('rset' argument or the input context) and
       
    48 match or not according to entity's (instance or class) properties.
       
    49 
       
    50 .. autoclass:: cubicweb.selectors.non_final_entity
       
    51 .. autoclass:: cubicweb.selectors.implements
       
    52 .. autoclass:: cubicweb.selectors.score_entity
       
    53 .. autoclass:: cubicweb.selectors.rql_condition
       
    54 .. autoclass:: cubicweb.selectors.relation_possible
       
    55 .. autoclass:: cubicweb.selectors.partial_relation_possible
       
    56 .. autoclass:: cubicweb.selectors.has_related_entities
       
    57 .. autoclass:: cubicweb.selectors.partial_has_related_entities
       
    58 .. autoclass:: cubicweb.selectors.has_permission
       
    59 .. autoclass:: cubicweb.selectors.has_add_permission
       
    60 
       
    61 
       
    62 Logged user selectors
       
    63 ~~~~~~~~~~~~~~~~~~~~~
       
    64 Those selectors are looking for properties of the user issuing the request.
       
    65 
       
    66 .. autoclass:: cubicweb.selectors.anonymous_user
       
    67 .. autoclass:: cubicweb.selectors.authenticated_user
       
    68 .. autoclass:: cubicweb.selectors.match_user_groups
       
    69 
       
    70 
       
    71 Web request selectors
       
    72 ~~~~~~~~~~~~~~~~~~~~~
       
    73 Those selectors are looking for properties of *web* request, they can not be
       
    74 used on the data repository side.
       
    75 
       
    76 .. autoclass:: cubicweb.selectors.match_form_params
       
    77 .. autoclass:: cubicweb.selectors.match_search_state
       
    78 .. autoclass:: cubicweb.selectors.match_context_prop
       
    79 .. autoclass:: cubicweb.selectors.match_view
       
    80 .. autoclass:: cubicweb.selectors.primary_view
       
    81 .. autoclass:: cubicweb.selectors.specified_etype_implements
       
    82 
       
    83 
       
    84 Other selectors
       
    85 ~~~~~~~~~~~~~~~
       
    86 .. autoclass:: cubicweb.selectors.match_transition
       
    87 
       
    88 You'll also find some other (very) specific selectors hidden in other modules
       
    89 than :mod:`cubicweb.selectors`.