Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

now really fixed the source formatting. brought to you by the magics …

…of IRC-based pair programming

git-svn-id: http://code.djangoproject.com/svn/django/trunk@1407 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit ca683d8ca54b7579eefba8ef52ccd35b04a66b63 1 parent eff2a1f
authored November 25, 2005

Showing 1 changed file with 6 additions and 7 deletions. Show diff stats Hide diff stats

  1. 13  django/views/debug.py
13  django/views/debug.py
@@ -12,7 +12,7 @@ def linebreak_iter(template_source):
12 12
     yield 0
13 13
     p = template_source.find('\n')
14 14
     while p >= 0:
15  
-        yield p
  15
+        yield p+1
16 16
         p = template_source.find('\n', p+1)
17 17
     yield len(template_source) + 1
18 18
 
@@ -23,18 +23,17 @@ def get_template_exception_info(exc_type, exc_value, tb):
23 23
     line = 0
24 24
     upto = 0
25 25
     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)):
28 27
         if start >= upto and end <= next:
29 28
             line = num
30  
-            before = escape(template_source[upto+1:start])
  29
+            before = escape(template_source[upto:start])
31 30
             during = escape(template_source[start:end])
32 31
             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])) )
34 33
         upto = next
35 34
     total = len(source_lines)
36 35
 
37  
-    top = max(0, line - context_lines)
  36
+    top = max(1, line - context_lines)
38 37
     bottom = min(total, line + 1 + context_lines)
39 38
 
40 39
     template_info = {
@@ -323,7 +322,7 @@ def _get_lines_from_file(filename, lineno, context_lines):
323 322
        <td>{{ template_info.before }}<span class="specific">{{ template_info.during }}</span>{{ template_info.after }}</td></tr>
324 323
    {% else %}
325 324
       <tr><th>{{ source_line.0 }}</th>
326  
-      <td> {{ source_line.1 }}</td></tr>
  325
+      <td>{{ source_line.1 }}</td></tr>
327 326
    {% endifequal %}
328 327
    {% endfor %}
329 328
    </table>

0 notes on commit ca683d8

Please sign in to comment.
Something went wrong with that request. Please try again.