Improved whitespace in debug templates.

Removed extra blank lines in the template text debug template,
and prevented overindentation in the HTML debug template.
This commit is contained in:
Tim Graham 2015-07-10 16:08:40 -04:00
parent 24620d71f2
commit 6bdd3840be
1 changed files with 26 additions and 24 deletions

View File

@ -762,11 +762,9 @@ TECHNICAL_500_TEMPLATE = ("""
{% for source_line in template_info.source_lines %} {% for source_line in template_info.source_lines %}
{% ifequal source_line.0 template_info.line %} {% ifequal source_line.0 template_info.line %}
<tr class="error"><th>{{ source_line.0 }}</th> <tr class="error"><th>{{ source_line.0 }}</th>
<td> <td>{{ template_info.before }}"""
{{ template_info.before }} """<span class="specific">{{ template_info.during }}</span>"""
<span class="specific">{{ template_info.during }}</span> """{{ template_info.after }}</td>
{{ template_info.after }}
</td>
</tr> </tr>
{% else %} {% else %}
<tr><th>{{ source_line.0 }}</th> <tr><th>{{ source_line.0 }}</th>
@ -808,7 +806,7 @@ TECHNICAL_500_TEMPLATE = ("""
{% endif %} {% endif %}
<ol start="{{ frame.lineno }}" class="context-line"> <ol start="{{ frame.lineno }}" class="context-line">
<li onclick="toggle('pre{{ frame.id }}', 'post{{ frame.id }}')"><pre> <li onclick="toggle('pre{{ frame.id }}', 'post{{ frame.id }}')"><pre>
{{ frame.context_line|escape }}</pre>{% if not is_email %} <span>...</span>{% endif %}</li></ol> """ """{{ frame.context_line|escape }}</pre>{% if not is_email %} <span>...</span>{% endif %}</li></ol>
{% if frame.post_context and not is_email %} {% if frame.post_context and not is_email %}
<ol start='{{ frame.lineno|add:"1" }}' class="post-context" id="post{{ frame.id }}"> <ol start='{{ frame.lineno|add:"1" }}' class="post-context" id="post{{ frame.id }}">
{% for line in frame.post_context %} {% for line in frame.post_context %}
@ -883,12 +881,14 @@ Using engine {{ entry.backend.name }}:
{% endif %}{% if template_info %} {% endif %}{% if template_info %}
Template error: Template error:
In template {{ template_info.name }}, error at line {{ template_info.line }} In template {{ template_info.name }}, error at line {{ template_info.line }}
{{ template_info.message }}{% for source_line in template_info.source_lines %} {{ template_info.message }}"""
{% ifequal source_line.0 template_info.line %} "{% for source_line in template_info.source_lines %}"
{{ source_line.0 }} : {{ template_info.before }} {{ template_info.during }} {{ template_info.after }} "{% ifequal source_line.0 template_info.line %}"
{% else %} " {{ source_line.0 }} : {{ template_info.before }} {{ template_info.during }} {{ template_info.after }}"
{{ source_line.0 }} : {{ source_line.1 }} "{% else %}"
{% endifequal %}{% endfor %}{% endif %} " {{ source_line.0 }} : {{ source_line.1 }}"
"""{% endifequal %}{% endfor %}{% endif %}
Traceback:{% for frame in frames %} Traceback:{% for frame in frames %}
{% ifchanged frame.exc_cause %}{% if frame.exc_cause %}{% if frame.exc_cause_explicit %} {% ifchanged frame.exc_cause %}{% if frame.exc_cause %}{% if frame.exc_cause_explicit %}
The above exception ({{ frame.exc_cause }}) was the direct cause of the following exception: The above exception ({{ frame.exc_cause }}) was the direct cause of the following exception:
@ -1055,7 +1055,7 @@ Exception Value: {{ exception_value|force_escape }}
</html> </html>
""") """)
TECHNICAL_500_TEXT_TEMPLATE = """{% firstof exception_type 'Report' %}{% if request %} at {{ request.path_info }}{% endif %} TECHNICAL_500_TEXT_TEMPLATE = ("""{% firstof exception_type 'Report' %}{% if request %} at {{ request.path_info }}{% endif %}
{% firstof exception_value 'No exception message supplied' %} {% firstof exception_value 'No exception message supplied' %}
{% if request %} {% if request %}
Request Method: {{ request.META.REQUEST_METHOD }} Request Method: {{ request.META.REQUEST_METHOD }}
@ -1081,16 +1081,18 @@ Using engine {{ entry.backend.name }}:
{% endif %}{% if template_info %} {% endif %}{% if template_info %}
Template error: Template error:
In template {{ template_info.name }}, error at line {{ template_info.line }} In template {{ template_info.name }}, error at line {{ template_info.line }}
{{ template_info.message }}{% for source_line in template_info.source_lines %} {{ template_info.message }}
{% ifequal source_line.0 template_info.line %} {% for source_line in template_info.source_lines %}"""
{{ source_line.0 }} : {{ template_info.before }} {{ template_info.during }} {{ template_info.after }} "{% ifequal source_line.0 template_info.line %}"
{% else %} " {{ source_line.0 }} : {{ template_info.before }} {{ template_info.during }} {{ template_info.after }}"
{{ source_line.0 }} : {{ source_line.1 }} "{% else %}"
{% endifequal %}{% endfor %}{% endif %}{% if frames %} " {{ source_line.0 }} : {{ source_line.1 }}"
Traceback: """{% endifequal %}{% endfor %}{% endif %}{% if frames %}
{% for frame in frames %}
{% ifchanged frame.exc_cause %} Traceback:"""
{% if frame.exc_cause %} "{% for frame in frames %}"
"{% ifchanged frame.exc_cause %}"
" {% if frame.exc_cause %}" """
{% if frame.exc_cause_explicit %} {% if frame.exc_cause_explicit %}
The above exception ({{ frame.exc_cause }}) was the direct cause of the following exception: The above exception ({{ frame.exc_cause }}) was the direct cause of the following exception:
{% else %} {% else %}
@ -1127,7 +1129,7 @@ Using settings module {{ settings.SETTINGS_MODULE }}{% for k, v in settings.item
You're seeing this error because you have DEBUG = True in your You're seeing this error because you have DEBUG = True in your
Django settings file. Change that to False, and Django will Django settings file. Change that to False, and Django will
display a standard page generated by the handler for this status code. display a standard page generated by the handler for this status code.
""" """)
TECHNICAL_404_TEMPLATE = """ TECHNICAL_404_TEMPLATE = """
<!DOCTYPE html> <!DOCTYPE html>