equal
deleted
inserted
replaced
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 |