backport changesets which should have been in stable branch. now *stable is 3.3* and *default is 3.4*
--- a/doc/book/en/annexes/faq.rst Fri Jun 05 10:26:35 2009 +0200
+++ b/doc/book/en/annexes/faq.rst Fri Jun 05 10:40:54 2009 +0200
@@ -273,14 +273,26 @@
---------------------------------------------------------------
You just need to put the appropriate context manager around view/component
- selection: ::
+ selection (one standard place in in vreg.py) : ::
+
+ def possible_objects(self, registry, *args, **kwargs):
+ """return an iterator on possible objects in a registry for this result set
- from cubicweb.common.selectors import traced_selection
- with traced_selection():
- comp = self.vreg.select_object('contentnavigation', 'wfhistory',
- self.req, rset, context='navcontentbottom')
+ actions returned are classes, not instances
+ """
+ from cubicweb.selectors import traced_selection
+ with traced_selection():
+ for vobjects in self.registry(registry).values():
+ try:
+ yield self.select(vobjects, *args, **kwargs)
+ except NoSelectableObject:
+ continue
- This will yield additional WARNINGs, like this: ::
+ Don't forget the 'from __future__ improt with_statement' at the
+ module top-level.
+
+ This will yield additional WARNINGs, like this:
+ ::
2009-01-09 16:43:52 - (cubicweb.selectors) WARNING: selector one_line_rset returned 0 for <class 'cubicweb.web.views.basecomponents.WFHistoryVComponent'>
@@ -351,4 +363,4 @@
$ psql mydb
mydb=> update cw_cwuser set cw_upassword='qHO8282QN5Utg' where cw_login='joe';
- UPDATE 1
\ No newline at end of file
+ UPDATE 1
--- a/web/views/management.py Fri Jun 05 10:26:35 2009 +0200
+++ b/web/views/management.py Fri Jun 05 10:40:54 2009 +0200
@@ -186,8 +186,8 @@
form.append_field(field)
field = guess_field(cwpermschema, self.schema.rschema('require_group'))
form.append_field(field)
- renderer = self.select_object('formrenderers', 'htable', self.req,
- display_progress_div=False)
+ renderer = self.vreg.select_object('formrenderers', 'htable', self.req,
+ rset=None, display_progress_div=False)
self.w(form.form_render(renderer=renderer))
@@ -244,8 +244,8 @@
submiturl = self.config['submit-url']
submitmail = self.config['submit-mail']
if submiturl or submitmail:
- form = self.select_object('forms', 'base', self.req,
- mainform=False)
+ form = self.vreg.select_object('forms', 'base', self.req, rset=None,
+ mainform=False)
binfo = text_error_description(ex, excinfo, req, eversion, cversions)
form.form_add_hidden('description', binfo)
form.form_add_hidden('__bugreporting', '1')