# HG changeset patch # User Aurelien Campeas # Date 1244139700 -7200 # Node ID 296e897ab8e12f9dacd1ea632ff64af882888b42 # Parent c865cc7100ca2fa5b78b415139e1f64e33665762 be more precise & helpful diff -r c865cc7100ca -r 296e897ab8e1 doc/book/en/annexes/faq.rst --- a/doc/book/en/annexes/faq.rst Thu Jun 04 17:53:33 2009 +0200 +++ b/doc/book/en/annexes/faq.rst Thu Jun 04 20:21:40 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 @@ -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