author | Adrien Di Mascio <Adrien.DiMascio@logilab.fr> |
Wed, 14 Jan 2009 11:42:52 +0100 | |
changeset 404 | 867f933eeb89 |
parent 356 | 27eec9130898 |
child 1253 | 9716a9f77980 |
permissions | -rw-r--r-- |
316
99943acb44af
[doc] Add sub-section about selectors and a little about registerer in views chapter.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
diff
changeset
|
1 |
.. -*- coding: utf-8 -*- |
99943acb44af
[doc] Add sub-section about selectors and a little about registerer in views chapter.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
diff
changeset
|
2 |
|
99943acb44af
[doc] Add sub-section about selectors and a little about registerer in views chapter.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
diff
changeset
|
3 |
Selectors |
99943acb44af
[doc] Add sub-section about selectors and a little about registerer in views chapter.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
diff
changeset
|
4 |
````````` |
99943acb44af
[doc] Add sub-section about selectors and a little about registerer in views chapter.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
diff
changeset
|
5 |
|
351
ebbcf31e200d
update selector section
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
316
diff
changeset
|
6 |
Selectors are scoring functions that are called by the view |
ebbcf31e200d
update selector section
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
316
diff
changeset
|
7 |
dispatcher to tell whenever a view can be applied to a given result |
ebbcf31e200d
update selector section
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
316
diff
changeset
|
8 |
set and request. Selector sets are the glue that tie views to the data |
ebbcf31e200d
update selector section
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
316
diff
changeset
|
9 |
model. Using them appropriately is an essential part of the |
ebbcf31e200d
update selector section
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
316
diff
changeset
|
10 |
construction of well behaved cubes. |
316
99943acb44af
[doc] Add sub-section about selectors and a little about registerer in views chapter.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
diff
changeset
|
11 |
|
351
ebbcf31e200d
update selector section
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
316
diff
changeset
|
12 |
When no score is higher than the others, an exception is raised |
ebbcf31e200d
update selector section
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
316
diff
changeset
|
13 |
``NoSelectableObject`` to let you know that the engine was not able to |
ebbcf31e200d
update selector section
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
316
diff
changeset
|
14 |
identify the view to apply. In such case you would need to review your |
ebbcf31e200d
update selector section
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
316
diff
changeset
|
15 |
design and make sure your views are properly defined. |
316
99943acb44af
[doc] Add sub-section about selectors and a little about registerer in views chapter.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
diff
changeset
|
16 |
|
99943acb44af
[doc] Add sub-section about selectors and a little about registerer in views chapter.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
diff
changeset
|
17 |
`CubicWeb` provides its own set of selectors that you can use and here |
99943acb44af
[doc] Add sub-section about selectors and a little about registerer in views chapter.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
diff
changeset
|
18 |
is a description of some of the most common used: |
99943acb44af
[doc] Add sub-section about selectors and a little about registerer in views chapter.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
diff
changeset
|
19 |
|
351
ebbcf31e200d
update selector section
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
316
diff
changeset
|
20 |
*yes* |
316
99943acb44af
[doc] Add sub-section about selectors and a little about registerer in views chapter.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
diff
changeset
|
21 |
This selector accepts everything which basically means to any result |
99943acb44af
[doc] Add sub-section about selectors and a little about registerer in views chapter.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
diff
changeset
|
22 |
set. |
99943acb44af
[doc] Add sub-section about selectors and a little about registerer in views chapter.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
diff
changeset
|
23 |
|
351
ebbcf31e200d
update selector section
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
316
diff
changeset
|
24 |
*none_rset* |
316
99943acb44af
[doc] Add sub-section about selectors and a little about registerer in views chapter.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
diff
changeset
|
25 |
This selector accepts no result set, so it can be applied to any |
99943acb44af
[doc] Add sub-section about selectors and a little about registerer in views chapter.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
diff
changeset
|
26 |
object. |
99943acb44af
[doc] Add sub-section about selectors and a little about registerer in views chapter.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
diff
changeset
|
27 |
|
351
ebbcf31e200d
update selector section
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
316
diff
changeset
|
28 |
*rset* |
ebbcf31e200d
update selector section
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
316
diff
changeset
|
29 |
This selector accepts any result set, whatever the number of objects |
316
99943acb44af
[doc] Add sub-section about selectors and a little about registerer in views chapter.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
diff
changeset
|
30 |
in the result set. |
99943acb44af
[doc] Add sub-section about selectors and a little about registerer in views chapter.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
diff
changeset
|
31 |
|
351
ebbcf31e200d
update selector section
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
316
diff
changeset
|
32 |
*nonempty_rset* |
316
99943acb44af
[doc] Add sub-section about selectors and a little about registerer in views chapter.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
diff
changeset
|
33 |
This selector accepts any non empty result set. |
99943acb44af
[doc] Add sub-section about selectors and a little about registerer in views chapter.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
diff
changeset
|
34 |
|
351
ebbcf31e200d
update selector section
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
316
diff
changeset
|
35 |
*empty_rset* |
ebbcf31e200d
update selector section
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
316
diff
changeset
|
36 |
This selector accepts empty (only) result set. |
316
99943acb44af
[doc] Add sub-section about selectors and a little about registerer in views chapter.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
diff
changeset
|
37 |
|
351
ebbcf31e200d
update selector section
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
316
diff
changeset
|
38 |
*one_line_rset* |
316
99943acb44af
[doc] Add sub-section about selectors and a little about registerer in views chapter.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
diff
changeset
|
39 |
This selector accepts result set with a single line of result. |
99943acb44af
[doc] Add sub-section about selectors and a little about registerer in views chapter.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
diff
changeset
|
40 |
|
351
ebbcf31e200d
update selector section
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
316
diff
changeset
|
41 |
*two_lines_rset* |
316
99943acb44af
[doc] Add sub-section about selectors and a little about registerer in views chapter.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
diff
changeset
|
42 |
This selector accepts result set with *at least* two lines of result. |
99943acb44af
[doc] Add sub-section about selectors and a little about registerer in views chapter.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
diff
changeset
|
43 |
|
351
ebbcf31e200d
update selector section
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
316
diff
changeset
|
44 |
*two_cols_rset* |
ebbcf31e200d
update selector section
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
316
diff
changeset
|
45 |
This selector accepts result set with *at least* one line and two columns of result. |
ebbcf31e200d
update selector section
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
316
diff
changeset
|
46 |
|
ebbcf31e200d
update selector section
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
316
diff
changeset
|
47 |
*anonymous_user* |
316
99943acb44af
[doc] Add sub-section about selectors and a little about registerer in views chapter.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
diff
changeset
|
48 |
This selector accepts if user is anonymous. |
99943acb44af
[doc] Add sub-section about selectors and a little about registerer in views chapter.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
diff
changeset
|
49 |
|
356 | 50 |
*authenticated_user* |
351
ebbcf31e200d
update selector section
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
316
diff
changeset
|
51 |
This selector accepts if user is authenticated. |
316
99943acb44af
[doc] Add sub-section about selectors and a little about registerer in views chapter.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
diff
changeset
|
52 |
|
99943acb44af
[doc] Add sub-section about selectors and a little about registerer in views chapter.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
diff
changeset
|
53 |
|
351
ebbcf31e200d
update selector section
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
316
diff
changeset
|
54 |
Of course you will write your own set of selectors as you get familiar with the |
316
99943acb44af
[doc] Add sub-section about selectors and a little about registerer in views chapter.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
diff
changeset
|
55 |
framework. |
99943acb44af
[doc] Add sub-section about selectors and a little about registerer in views chapter.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
diff
changeset
|
56 |