[FAQ] debugging selectors : a new faq entry
authorAurelien Campeas <aurelien.campeas@logilab.fr>
Fri, 09 Jan 2009 16:56:51 +0100
changeset 383 66804d97b919
parent 380 06e7f2932afe
child 384 f117f6cefad0
[FAQ] debugging selectors : a new faq entry
doc/book/en/D010-faq.en.txt
--- a/doc/book/en/D010-faq.en.txt	Fri Jan 09 15:29:51 2009 +0100
+++ b/doc/book/en/D010-faq.en.txt	Fri Jan 09 16:56:51 2009 +0100
@@ -211,3 +211,17 @@
 
   Any change applied to configuration file requires to restart your
   application.
+
+* I get NoSelectableObject exceptions: how do I debug selectors ?
+
+  You just need to put the appropriate context manager around view/component
+  selection: ::
+
+    from cubicweb.common.selectors import traced_selection
+    with traced_selection():
+        comp = self.vreg.select_object('contentnavigation', 'wfhistory',
+                                       self.req, rset, context='navcontentbottom')
+
+  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'>