# HG changeset patch # User Laurent Peuch # Date 1574796418 -3600 # Node ID 7c4216ed7497288e452d05569692d23115b47837 # Parent 3cbcbaead477397405a59170c75577b58ffc086f [debug-toolbar/display_source_code] add links to files in tracebacks diff -r 3cbcbaead477 -r 7c4216ed7497 cubicweb/pyramid/debug_toolbar_templates/rql.dbtmako --- a/cubicweb/pyramid/debug_toolbar_templates/rql.dbtmako Fri Sep 27 07:00:51 2019 +0200 +++ b/cubicweb/pyramid/debug_toolbar_templates/rql.dbtmako Tue Nov 26 20:26:58 2019 +0100 @@ -47,7 +47,7 @@ -
${highlight(query["callstack"], "py3tb", linenos="inline") | n}
+
${source_code_url_in_stack(highlight(query["callstack"], "py3tb", linenos="inline"), highlighted=has_pygments) | n}
diff -r 3cbcbaead477 -r 7c4216ed7497 cubicweb/pyramid/debug_toolbar_templates/sql.dbtmako --- a/cubicweb/pyramid/debug_toolbar_templates/sql.dbtmako Fri Sep 27 07:00:51 2019 +0200 +++ b/cubicweb/pyramid/debug_toolbar_templates/sql.dbtmako Tue Nov 26 20:26:58 2019 +0100 @@ -29,7 +29,7 @@ -
${highlight(query["callstack"], "py3tb", linenos="inline") | n}
+
${source_code_url_in_stack(highlight(query["callstack"], "py3tb", linenos="inline"), highlighted=has_pygments) | n}
diff -r 3cbcbaead477 -r 7c4216ed7497 cubicweb/pyramid/debugtoolbar_panels.py --- a/cubicweb/pyramid/debugtoolbar_panels.py Fri Sep 27 07:00:51 2019 +0200 +++ b/cubicweb/pyramid/debugtoolbar_panels.py Tue Nov 26 20:26:58 2019 +0100 @@ -19,7 +19,8 @@ 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 +from cubicweb.misc.source_highlight import highlight_html, generate_css, has_pygments +from cubicweb.pyramid.debug_source_code import source_code_url, source_code_url_in_stack class CubicWebDebugPanel(DebugPanel): @@ -169,6 +170,8 @@ 'sql_queries': [], 'highlight': highlight_html, 'generate_css': generate_css, + 'has_pygments': has_pygments, + 'source_code_url_in_stack': source_code_url_in_stack, } subscribe_to_debug_channel("rql", self.collect_rql_queries) subscribe_to_debug_channel("sql", self.collect_sql_queries) @@ -225,6 +228,8 @@ 'sql_queries': [], 'highlight': highlight_html, 'generate_css': generate_css, + 'has_pygments': has_pygments, + 'source_code_url_in_stack': source_code_url_in_stack, } subscribe_to_debug_channel("rql", self.collect_rql_queries) subscribe_to_debug_channel("sql", self.collect_sql_queries)