Django

Code

Changeset 1407

Show
Ignore:
Timestamp:
11/24/05 18:04:06 (3 years ago)
Author:
hugo
Message:

now really fixed the source formatting. brought to you by the magics of IRC-based pair programming

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • django/trunk/django/views/debug.py

    r1406 r1407  
    1313    p = template_source.find('\n') 
    1414    while p >= 0: 
    15         yield p 
     15        yield p+1 
    1616        p = template_source.find('\n', p+1) 
    1717    yield len(template_source) + 1 
     
    2424    upto = 0 
    2525    source_lines = [] 
    26     linebreaks = izip(count(0), linebreak_iter(template_source)) 
    27     for num, next in linebreaks: 
     26    for num, next in enumerate(linebreak_iter(template_source)): 
    2827        if start >= upto and end <= next: 
    2928            line = num 
    30             before = escape(template_source[upto+1:start]) 
     29            before = escape(template_source[upto:start]) 
    3130            during = escape(template_source[start:end]) 
    3231            after = escape(template_source[end:next]) 
    33         source_lines.append( (num, escape(template_source[upto+1:next])) ) 
     32        source_lines.append( (num, escape(template_source[upto:next])) ) 
    3433        upto = next 
    3534    total = len(source_lines) 
    3635 
    37     top = max(0, line - context_lines) 
     36    top = max(1, line - context_lines) 
    3837    bottom = min(total, line + 1 + context_lines) 
    3938 
     
    324323   {% else %} 
    325324      <tr><th>{{ source_line.0 }}</th> 
    326       <td> {{ source_line.1 }}</td></tr> 
     325      <td>{{ source_line.1 }}</td></tr> 
    327326   {% endifequal %} 
    328327   {% endfor %}