Ticket #6495: 0036-Fix-traceback-HTML-syntax.patch

File 0036-Fix-traceback-HTML-syntax.patch, 2.0 KB (added by Bastian Kleineidam <calvin@…>, 8 years ago)
  • django/views/debug.py

    From afa81a914b65fccc8126db98bc3d3cf0987ede3d Mon Sep 17 00:00:00 2001
    From: Bastian Kleineidam <calvin@debian.org>
    Date: Sun, 27 Jan 2008 21:52:54 +0100
    Subject: Fix traceback HTML syntax
    
    Don't render empty <li> list elements due to empty traceback lines.
    
    Signed-off-by: Bastian Kleineidam <calvin@debian.org>
    
    diff --git a/django/views/debug.py b/django/views/debug.py
    index 1193a81..09393a7 100644
    a b TECHNICAL_500_TEMPLATE = """ 
    442442          {% if frame.context_line %}
    443443            <div class="context" id="c{{ frame.id }}">
    444444              {% if frame.pre_context %}
    445                 <ol start="{{ frame.pre_context_lineno }}" class="pre-context" id="pre{{ frame.id }}">{% for line in frame.pre_context %}<li onclick="toggle('pre{{ frame.id }}', 'post{{ frame.id }}')">{{ line|escape }}</li>{% endfor %}</ol>
     445                <ol start="{{ frame.pre_context_lineno }}" class="pre-context" id="pre{{ frame.id }}">{% for line in frame.pre_context %}{% if line %}<li onclick="toggle('pre{{ frame.id }}', 'post{{ frame.id }}')">{{ line|escape }}</li>{% endif %}{% endfor %}</ol>
    446446              {% endif %}
    447447              <ol start="{{ frame.lineno }}" class="context-line"><li onclick="toggle('pre{{ frame.id }}', 'post{{ frame.id }}')">{{ frame.context_line|escape }} <span>...</span></li></ol>
    448448              {% if frame.post_context %}
    449                 <ol start='{{ frame.lineno|add:"1" }}' class="post-context" id="post{{ frame.id }}">{% for line in frame.post_context %}<li onclick="toggle('pre{{ frame.id }}', 'post{{ frame.id }}')">{{ line|escape }}</li>{% endfor %}</ol>
     449                <ol start='{{ frame.lineno|add:"1" }}' class="post-context" id="post{{ frame.id }}">{% for line in frame.post_context %}{% if line %}<li onclick="toggle('pre{{ frame.id }}', 'post{{ frame.id }}')">{{ line|escape }}</li>{% endif %}{% endfor %}</ol>
    450450              {% endif %}
    451451            </div>
    452452          {% endif %}
Back to Top