cubicweb/pyramid/debugtoolbar_panels.py
changeset 12764 fb97669efcaa
parent 12763 5c609202eb61
child 12765 771c99f16780
--- a/cubicweb/pyramid/debugtoolbar_panels.py	Mon Nov 18 12:41:44 2019 +0100
+++ b/cubicweb/pyramid/debugtoolbar_panels.py	Tue Oct 08 23:11:19 2019 +0200
@@ -21,6 +21,39 @@
 from cubicweb.misc.source_highlight import highlight_html, generate_css
 
 
+class CubicWebDebugPanel(DebugPanel):
+    """
+    CubicWeb general debug panel
+    """
+
+    """
+    Excepted formats:
+    Controller: {
+        "kind": ctrlid,
+        "request": req,
+        "path": req.path,
+        "controller": controller,
+    }
+    """
+
+    name = 'CubicWeb'
+    nav_title = 'CubicWeb'
+    title = 'CubicWeb general panel'
+
+    has_content = True
+    template = 'cubicweb.pyramid:debug_toolbar_templates/cw.dbtmako'
+
+    def __init__(self, request):
+        self.data = {'controller': None}
+        subscribe_to_debug_channel("controller", self.collect_controller)
+
+    def collect_controller(self, controller):
+        self.data["controller"] = controller
+
+    def process_response(self, response):
+        unsubscribe_to_debug_channel("controller", self.collect_controller)
+
+
 class RQLDebugPanel(DebugPanel):
     """
     CubicWeb RQL debug panel
@@ -78,4 +111,5 @@
 
 
 def includeme(config):
+    config.add_debugtoolbar_panel(CubicWebDebugPanel)
     config.add_debugtoolbar_panel(RQLDebugPanel)