File tree Expand file tree Collapse file tree 3 files changed +6
-10
lines changed
templates/debug_toolbar/panels Expand file tree Collapse file tree 3 files changed +6
-10
lines changed Original file line number Diff line number Diff line change 33from django .template import Origin , TemplateDoesNotExist
44from django .template .engine import Engine
55from django .template .loader import render_to_string
6- from django .utils .safestring import mark_safe
6+ from django .utils .html import format_html , mark_safe
77
88from debug_toolbar .decorators import require_show_toolbar
99
@@ -50,12 +50,11 @@ def template_source(request):
5050 from pygments import highlight
5151 from pygments .formatters import HtmlFormatter
5252 from pygments .lexers import HtmlDjangoLexer
53-
53+ except ModuleNotFoundError :
54+ source = format_html ("<code>{}</code>" , source )
55+ else :
5456 source = highlight (source , HtmlDjangoLexer (), HtmlFormatter ())
5557 source = mark_safe (source )
56- source .pygmentized = True
57- except ImportError :
58- pass
5958
6059 content = render_to_string (
6160 "debug_toolbar/panels/template_source.html" ,
Original file line number Diff line number Diff line change @@ -5,10 +5,6 @@ <h3>{% trans "Template source:" %} <code>{{ template_name }}</code></h3>
55</ div >
66< div class ="djDebugPanelContent ">
77 < div class ="djdt-scroll ">
8- {% if not source.pygmentized %}
9- < code > {{ source }}</ code >
10- {% else %}
11- {{ source }}
12- {% endif %}
8+ {{ source }}
139 </ div >
1410</ div >
Original file line number Diff line number Diff line change 1717 coverage
1818 Jinja2
1919 html5lib
20+ pygments
2021 selenium
2122 sqlparse
2223passenv =
You can’t perform that action at this time.
0 commit comments