[debug-toolbar/registry] move to Registry.add_select_best_listener new api
authorLaurent Peuch <cortex@worlddomination.be>
Thu, 28 Nov 2019 16:33:15 +0100
changeset 12785 a9025212ce0c
parent 12784 894d0fd94f73
child 12786 8a1b7aaf8309
[debug-toolbar/registry] move to Registry.add_select_best_listener new api
cubicweb/cwvreg.py
--- a/cubicweb/cwvreg.py	Tue Dec 03 11:34:56 2019 +0100
+++ b/cubicweb/cwvreg.py	Thu Nov 28 16:33:15 2019 +0100
@@ -72,16 +72,10 @@
         """
         super(CWRegistry, self).__init__(True)
         self.vreg = vreg
+        self.add_select_best_listener(self._emit_registry_debug_information)
 
-    def _select_best(self, objects, *args, **kwargs):
-        """
-        Overwrite version of Registry._select_best to emit debug information.
-        """
-        def emit_registry_debug_information(debug_registry_select_best):
-            emit_to_debug_channel("registry_decisions", debug_registry_select_best)
-
-        kwargs["debug_callback"] = emit_registry_debug_information
-        return super()._select_best(objects, *args, **kwargs)
+    def _emit_registry_debug_information(self, debug_registry_select_best):
+        emit_to_debug_channel("registry_decisions", debug_registry_select_best)
 
     @property
     def schema(self):