selectors.py
changeset 2834 7df3494ae657
parent 2822 f26578339214
child 3023 7864fee8b4ec
equal deleted inserted replaced
2833:9aa47a3c0dfe 2834:7df3494ae657
    52 
    52 
    53 from cubicweb import (Unauthorized, NoSelectableObject, NotAnEntity,
    53 from cubicweb import (Unauthorized, NoSelectableObject, NotAnEntity,
    54                       role, typed_eid)
    54                       role, typed_eid)
    55 # even if not used, let yes here so it's importable through this module
    55 # even if not used, let yes here so it's importable through this module
    56 from cubicweb.appobject import Selector, objectify_selector, yes
    56 from cubicweb.appobject import Selector, objectify_selector, yes
       
    57 from cubicweb.vregistry import class_regid
    57 from cubicweb.cwconfig import CubicWebConfiguration
    58 from cubicweb.cwconfig import CubicWebConfiguration
    58 from cubicweb.schema import split_expression
    59 from cubicweb.schema import split_expression
    59 
    60 
    60 # helpers for debugging selectors
    61 # helpers for debugging selectors
    61 SELECTOR_LOGGER = logging.getLogger('cubicweb.selectors')
    62 SELECTOR_LOGGER = logging.getLogger('cubicweb.selectors')
    72             selname = str(cls)
    73             selname = str(cls)
    73             vobj = args[0]
    74             vobj = args[0]
    74         else:
    75         else:
    75             selname = selector.__name__
    76             selname = selector.__name__
    76             vobj = cls
    77             vobj = cls
    77         oid = vobj.id
    78         oid = class_regid(vobj)
    78         ret = selector(cls, *args, **kwargs)
    79         ret = selector(cls, *args, **kwargs)
    79         if TRACED_OIDS == 'all' or oid in TRACED_OIDS:
    80         if TRACED_OIDS == 'all' or oid in TRACED_OIDS:
    80             #SELECTOR_LOGGER.warning('selector %s returned %s for %s', selname, ret, cls)
    81             #SELECTOR_LOGGER.warning('selector %s returned %s for %s', selname, ret, cls)
    81             print '%s -> %s for %s' % (selname, ret, vobj)
    82             print '%s -> %s for %s' % (selname, ret, vobj)
    82         return ret
    83         return ret