doc/book/en/annexes/faq.rst
branchstable
changeset 2041 296e897ab8e1
parent 1900 8dd4bb69c73d
child 2150 746c5e6acd38
child 2172 cf8f9180e63e
equal deleted inserted replaced
2040:c865cc7100ca 2041:296e897ab8e1
   271 
   271 
   272 I get NoSelectableObject exceptions: how do I debug selectors ?
   272 I get NoSelectableObject exceptions: how do I debug selectors ?
   273 ---------------------------------------------------------------
   273 ---------------------------------------------------------------
   274 
   274 
   275   You just need to put the appropriate context manager around view/component
   275   You just need to put the appropriate context manager around view/component
   276   selection: ::
   276   selection (one standard place in in vreg.py) : ::
   277 
   277 
   278     from cubicweb.common.selectors import traced_selection
   278     def possible_objects(self, registry, *args, **kwargs):
   279     with traced_selection():
   279         """return an iterator on possible objects in a registry for this result set
   280         comp = self.vreg.select_object('contentnavigation', 'wfhistory',
   280 
   281                                        self.req, rset, context='navcontentbottom')
   281         actions returned are classes, not instances
   282 
   282         """
   283   This will yield additional WARNINGs, like this: ::
   283         from cubicweb.selectors import traced_selection
       
   284         with traced_selection():
       
   285             for vobjects in self.registry(registry).values():
       
   286                 try:
       
   287                     yield self.select(vobjects, *args, **kwargs)
       
   288                 except NoSelectableObject:
       
   289                     continue
       
   290 
       
   291   Don't forget the 'from __future__ improt with_statement' at the
       
   292   module top-level.
       
   293 
       
   294   This will yield additional WARNINGs, like this:
       
   295   ::
   284 
   296 
   285     2009-01-09 16:43:52 - (cubicweb.selectors) WARNING: selector one_line_rset returned 0 for <class 'cubicweb.web.views.basecomponents.WFHistoryVComponent'>
   297     2009-01-09 16:43:52 - (cubicweb.selectors) WARNING: selector one_line_rset returned 0 for <class 'cubicweb.web.views.basecomponents.WFHistoryVComponent'>
   286 
   298 
   287 How to format an entity date attribute?
   299 How to format an entity date attribute?
   288 ---------------------------------------
   300 ---------------------------------------