diff --git a/django/views/debug.py b/django/views/debug.py index 7c45af230a..3358d2f08e 100644 --- a/django/views/debug.py +++ b/django/views/debug.py @@ -422,11 +422,11 @@ TECHNICAL_500_TEMPLATE = """ {% if frame.context_line %}
{% if frame.pre_context %} -
    {% for line in frame.pre_context %}
  1. {{ line }}
  2. {% endfor %}
+
    {% for line in frame.pre_context %}
  1. {{ line|escape }}
  2. {% endfor %}
{% endif %} -
  1. {{ frame.context_line }} ...
+
  1. {{ frame.context_line|escape }} ...
{% if frame.post_context %} -
    {% for line in frame.post_context %}
  1. {{ line }}
  2. {% endfor %}
+
    {% for line in frame.post_context %}
  1. {{ line|escape }}
  2. {% endfor %}
{% endif %}
{% endif %} @@ -445,8 +445,8 @@ TECHNICAL_500_TEMPLATE = """ {% for var in frame.vars|dictsort:"0" %} - {{ var.0 }} -
{{ var.1|pprint }}
+ {{ var.0|escape }} +
{{ var.1|pprint|escape }}
{% endfor %} @@ -466,7 +466,7 @@ Traceback (most recent call last):
{% for frame in frames %} File "{{ frame.filename }}" in {{ frame.function }}
{% if frame.context_line %} -   {{ frame.lineno }}. {{ frame.context_line }}
+   {{ frame.lineno }}. {{ frame.context_line|escape }}
{% endif %} {% endfor %}
  {{ exception_type }} at {{ request.path|escape }}