Commit 621b07a9 authored by Laurent Peuch's avatar Laurent Peuch
Browse files

[debug-toolbar] link to source code of all objects/classes

Closes #17256791
parent 38f22b8b4459
...@@ -12,9 +12,9 @@ ...@@ -12,9 +12,9 @@
<tbody> <tbody>
<tr> <tr>
<td>${controller["kind"]}</td> <td>${controller["kind"]}</td>
<td>${controller["request"]}</td> <td>${controller["request"]} ${source_code_url(controller["request"]) | n}</td>
<td>${controller["path"]}</td> <td>${controller["path"]}</td>
<td>${controller["controller"]}</td> <td>${controller["controller"]} ${source_code_url(controller["controller"]) | n}</td>
</tr> </tr>
</tbody> </tbody>
</table> </table>
......
...@@ -30,7 +30,7 @@ ...@@ -30,7 +30,7 @@
% else: % else:
${value} ${value}
% endif % endif
${source_code_url(value) | n}
<ul> <ul>
% if hasattr(value, "cw_etype"): % if hasattr(value, "cw_etype"):
<li>regid: '${value.cw_etype}'</li> <li>regid: '${value.cw_etype}'</li>
......
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
<tr></tr> <tr></tr>
% for registry_decision in registry_decisions: % for registry_decision in registry_decisions:
<tr> <tr>
<td colspan="2"><b>${repr(registry_decision["key"])} -&gt; ${render_object(registry_decision["winner"])}</b></td> <td colspan="2"><b>${repr(registry_decision["key"])} -&gt; ${render_object(registry_decision["winner"])} ${source_code_url(registry_decision["winner"]) | n}</b></td>
</tr> </tr>
<tr> <tr>
<td> <td>
...@@ -33,7 +33,7 @@ ...@@ -33,7 +33,7 @@
<ul> <ul>
% for obj in registry_decision["all_objects"]: % for obj in registry_decision["all_objects"]:
<li> <li>
${obj["score"]}: ${render_object(obj["object"])} ${obj["score"]}: ${render_object(obj["object"])} ${source_code_url(obj["object"]) | n}
</li> </li>
% endfor % endfor
</ul> </ul>
......
...@@ -17,6 +17,7 @@ ...@@ -17,6 +17,7 @@
# with CubicWeb. If not, see <http://www.gnu.org/licenses/>. # with CubicWeb. If not, see <http://www.gnu.org/licenses/>.
from pyramid_debugtoolbar.panels import DebugPanel from pyramid_debugtoolbar.panels import DebugPanel
from cubicweb.debug import subscribe_to_debug_channel, unsubscribe_to_debug_channel from cubicweb.debug import subscribe_to_debug_channel, unsubscribe_to_debug_channel
from cubicweb.misc.source_highlight import highlight_html, generate_css from cubicweb.misc.source_highlight import highlight_html, generate_css
...@@ -44,7 +45,11 @@ class CubicWebDebugPanel(DebugPanel): ...@@ -44,7 +45,11 @@ class CubicWebDebugPanel(DebugPanel):
template = 'cubicweb.pyramid:debug_toolbar_templates/cw.dbtmako' template = 'cubicweb.pyramid:debug_toolbar_templates/cw.dbtmako'
def __init__(self, request): def __init__(self, request):
self.data = {'controller': None} self.data = {
'controller': None,
'source_code_url': source_code_url,
}
subscribe_to_debug_channel("controller", self.collect_controller) subscribe_to_debug_channel("controller", self.collect_controller)
def collect_controller(self, controller): def collect_controller(self, controller):
...@@ -73,6 +78,7 @@ class RegistryDecisionsDebugPanel(DebugPanel): ...@@ -73,6 +78,7 @@ class RegistryDecisionsDebugPanel(DebugPanel):
'vreg': None, 'vreg': None,
'highlight': highlight_html, 'highlight': highlight_html,
'generate_css': generate_css, 'generate_css': generate_css,
'source_code_url': source_code_url,
} }
subscribe_to_debug_channel("vreg", self.collect_vreg) subscribe_to_debug_channel("vreg", self.collect_vreg)
...@@ -120,7 +126,10 @@ class RegistryDebugPanel(DebugPanel): ...@@ -120,7 +126,10 @@ class RegistryDebugPanel(DebugPanel):
template = 'cubicweb.pyramid:debug_toolbar_templates/registry.dbtmako' template = 'cubicweb.pyramid:debug_toolbar_templates/registry.dbtmako'
def __init__(self, request): def __init__(self, request):
self.data = {'vreg': None} self.data = {
'vreg': None,
'source_code_url': source_code_url,
}
subscribe_to_debug_channel("vreg", self.collect_vreg) subscribe_to_debug_channel("vreg", self.collect_vreg)
def collect_vreg(self, message): def collect_vreg(self, message):
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment