cubicweb/cwvreg.py
changeset 12768 7d2c61d40fe9
parent 12567 26744ad37953
child 12785 a9025212ce0c
equal deleted inserted replaced
12767:d50661367401 12768:7d2c61d40fe9
    31 
    31 
    32 from rql import RQLHelper
    32 from rql import RQLHelper
    33 from yams.constraints import BASE_CONVERTERS
    33 from yams.constraints import BASE_CONVERTERS
    34 
    34 
    35 from cubicweb import _
    35 from cubicweb import _
       
    36 from cubicweb.debug import emit_to_debug_channel
    36 from cubicweb import (CW_SOFTWARE_ROOT, ETYPE_NAME_MAP, CW_EVENT_MANAGER,
    37 from cubicweb import (CW_SOFTWARE_ROOT, ETYPE_NAME_MAP, CW_EVENT_MANAGER,
    37                       onevent, Binary, UnknownProperty, UnknownEid)
    38                       onevent, Binary, UnknownProperty, UnknownEid)
    38 from cubicweb.predicates import appobject_selectable, _reset_is_instance_cache
    39 from cubicweb.predicates import appobject_selectable, _reset_is_instance_cache
    39 
    40 
    40 
    41 
    69         """
    70         """
    70         :param vreg: the :py:class:`CWRegistryStore` managing this registry.
    71         :param vreg: the :py:class:`CWRegistryStore` managing this registry.
    71         """
    72         """
    72         super(CWRegistry, self).__init__(True)
    73         super(CWRegistry, self).__init__(True)
    73         self.vreg = vreg
    74         self.vreg = vreg
       
    75 
       
    76     def _select_best(self, objects, *args, **kwargs):
       
    77         """
       
    78         Overwrite version of Registry._select_best to emit debug information.
       
    79         """
       
    80         def emit_registry_debug_information(debug_registry_select_best):
       
    81             emit_to_debug_channel("registry_decisions", debug_registry_select_best)
       
    82 
       
    83         kwargs["debug_callback"] = emit_registry_debug_information
       
    84         return super()._select_best(objects, *args, **kwargs)
    74 
    85 
    75     @property
    86     @property
    76     def schema(self):
    87     def schema(self):
    77         """The :py:class:`cubicweb.schema.CubicWebSchema`
    88         """The :py:class:`cubicweb.schema.CubicWebSchema`
    78         """
    89         """