# HG changeset patch # User Aurelien Campeas # Date 1231343424 -3600 # Node ID ebbcf31e200d6d8f408cc5f13bb9a38c5a4520ba # Parent bc1f1addd34be1509f0906cdcf07a6a7bf9cba84 update selector section diff -r bc1f1addd34b -r ebbcf31e200d doc/book/en/B1021-views-selectors.en.txt --- a/doc/book/en/B1021-views-selectors.en.txt Wed Jan 07 16:11:45 2009 +0100 +++ b/doc/book/en/B1021-views-selectors.en.txt Wed Jan 07 16:50:24 2009 +0100 @@ -3,52 +3,54 @@ Selectors ````````` -A selector is responsible to score how well an object may be used with a -given result set during publishing time selection. This enables the selection -of the most appropriate views to a given result set. +Selectors are scoring functions that are called by the view +dispatcher to tell whenever a view can be applied to a given result +set and request. Selector sets are the glue that tie views to the data +model. Using them appropriately is an essential part of the +construction of well behaved cubes. -A selector is a method that computes a score. This score is used by -`CubicWeb` engine to identify which view is the best to apply in the -context. In the case, no score is higher than the others, then an -exception is raised ``NoSelectableObject`` to let you know that the -engine was not able to identify the view to apply. In such case -you would need to review your design and make sure your views are -properly defined. +When no score is higher than the others, an exception is raised +``NoSelectableObject`` to let you know that the engine was not able to +identify the view to apply. In such case you would need to review your +design and make sure your views are properly defined. `CubicWeb` provides its own set of selectors that you can use and here is a description of some of the most common used: -*yes_selector* +*yes* This selector accepts everything which basically means to any result set. -*norset_selector* +*none_rset* This selector accepts no result set, so it can be applied to any object. -*rset_selector* - This selector accepts result set, whatever the number of objects +*rset* + This selector accepts any result set, whatever the number of objects in the result set. -*anyrset_selector* +*nonempty_rset* This selector accepts any non empty result set. -*emptyrset_selector* - This selector accepts empty result set. +*empty_rset* + This selector accepts empty (only) result set. -*onelinerset_selector* +*one_line_rset* This selector accepts result set with a single line of result. -*twolinerset_selector* +*two_lines_rset* This selector accepts result set with *at least* two lines of result. -*anonymous_selector* +*two_cols_rset* + This selector accepts result set with *at least* one line and two columns of result. + +*anonymous_user* This selector accepts if user is anonymous. -*not_anonymous_selector* - This selector accepta if user is authenticated. +*authencated_user* + This selector accepts if user is authenticated. -Of course you can write your own set of selectors as you get familiar with the +Of course you will write your own set of selectors as you get familiar with the framework.