File tree 3 files changed +6
-10
lines changed
templates/debug_toolbar/panels
3 files changed +6
-10
lines changed Original file line number Diff line number Diff line change 3
3
from django .template import Origin , TemplateDoesNotExist
4
4
from django .template .engine import Engine
5
5
from 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
7
7
8
8
from debug_toolbar .decorators import require_show_toolbar
9
9
@@ -50,12 +50,11 @@ def template_source(request):
50
50
from pygments import highlight
51
51
from pygments .formatters import HtmlFormatter
52
52
from pygments .lexers import HtmlDjangoLexer
53
-
53
+ except ModuleNotFoundError :
54
+ source = format_html ("<code>{}</code>" , source )
55
+ else :
54
56
source = highlight (source , HtmlDjangoLexer (), HtmlFormatter ())
55
57
source = mark_safe (source )
56
- source .pygmentized = True
57
- except ImportError :
58
- pass
59
58
60
59
content = render_to_string (
61
60
"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>
5
5
</ div >
6
6
< div class ="djDebugPanelContent ">
7
7
< div class ="djdt-scroll ">
8
- {% if not source.pygmentized %}
9
- < code > {{ source }}</ code >
10
- {% else %}
11
- {{ source }}
12
- {% endif %}
8
+ {{ source }}
13
9
</ div >
14
10
</ div >
Original file line number Diff line number Diff line change 17
17
coverage
18
18
Jinja2
19
19
html5lib
20
+ pygments
20
21
selenium
21
22
sqlparse
22
23
passenv =
You can’t perform that action at this time.
0 commit comments