--- a/common/selectors.py Wed Jan 07 18:30:00 2009 +0100
+++ b/common/selectors.py Wed Jan 07 18:32:45 2009 +0100
@@ -207,7 +207,7 @@
if not req.search_state[0] in cls.search_states:
return 0
except AttributeError:
- return 1 # class don't care about search state, accept it
+ return 1 # class doesn't care about search state, accept it
return 1
searchstate_selector = deprecated_function(match_search_state)
--- a/doc/book/en/B1021-views-selectors.en.txt Wed Jan 07 18:30:00 2009 +0100
+++ b/doc/book/en/B1021-views-selectors.en.txt Wed Jan 07 18:32:45 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.
+*authenticated_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.
Binary file web/data/tab.png has changed
--- a/web/views/basecontrollers.py Wed Jan 07 18:30:00 2009 +0100
+++ b/web/views/basecontrollers.py Wed Jan 07 18:32:45 2009 +0100
@@ -356,7 +356,6 @@
extraargs = dict((str(key), value)
for key, value in extraargs.items())
extraargs = extraargs or {}
- print 'extraargs =', extraargs
return self._set_content_type(comp, comp.dispatch(**extraargs))
@check_pageid
--- a/web/views/baseviews.py Wed Jan 07 18:30:00 2009 +0100
+++ b/web/views/baseviews.py Wed Jan 07 18:32:45 2009 +0100
@@ -657,12 +657,12 @@
self._marker('description', entity.dc_description())
self._marker('dc:date', entity.dc_date(self.date_format))
if entity.creator:
- self.w('<author>')
+ self.w(u'<author>')
self._marker('name', entity.creator.name())
email = entity.creator.get_email()
if email:
self._marker('email', email)
- self.w('</author>')
+ self.w(u'</author>')
self.w(u'</item>\n')
def _marker(self, marker, value):