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 @@
<tbody>
<tr>
<td>${controller["kind"]}</td>
<td>${controller["request"]}</td>
<td>${controller["request"]} ${source_code_url(controller["request"]) | n}</td>
<td>${controller["path"]}</td>
<td>${controller["controller"]}</td>
<td>${controller["controller"]} ${source_code_url(controller["controller"]) | n}</td>
</tr>
</tbody>
</table>
......
......@@ -30,7 +30,7 @@
% else:
${value}
% endif
${source_code_url(value) | n}
<ul>
% if hasattr(value, "cw_etype"):
<li>regid: '${value.cw_etype}'</li>
......
......@@ -14,7 +14,7 @@
<tr></tr>
% for registry_decision in registry_decisions:
<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>
<td>
......@@ -33,7 +33,7 @@
<ul>
% for obj in registry_decision["all_objects"]:
<li>
${obj["score"]}: ${render_object(obj["object"])}
${obj["score"]}: ${render_object(obj["object"])} ${source_code_url(obj["object"]) | n}
</li>
% endfor
</ul>
......
......@@ -17,6 +17,7 @@
# with CubicWeb. If not, see <http://www.gnu.org/licenses/>.
from pyramid_debugtoolbar.panels import DebugPanel
from cubicweb.debug import subscribe_to_debug_channel, unsubscribe_to_debug_channel
from cubicweb.misc.source_highlight import highlight_html, generate_css
......@@ -44,7 +45,11 @@ class CubicWebDebugPanel(DebugPanel):
template = 'cubicweb.pyramid:debug_toolbar_templates/cw.dbtmako'
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)
def collect_controller(self, controller):
......@@ -73,6 +78,7 @@ class RegistryDecisionsDebugPanel(DebugPanel):
'vreg': None,
'highlight': highlight_html,
'generate_css': generate_css,
'source_code_url': source_code_url,
}
subscribe_to_debug_channel("vreg", self.collect_vreg)
......@@ -120,7 +126,10 @@ class RegistryDebugPanel(DebugPanel):
template = 'cubicweb.pyramid:debug_toolbar_templates/registry.dbtmako'
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)
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