doc/book/en/annexes/faq.rst
branchstable
changeset 2041 296e897ab8e1
parent 1900 8dd4bb69c73d
child 2150 746c5e6acd38
child 2172 cf8f9180e63e
--- 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 <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