diff options
| author | Georg Bauer <gb@hugo.westfalen.de> | 2005-11-25 00:04:06 +0000 |
|---|---|---|
| committer | Georg Bauer <gb@hugo.westfalen.de> | 2005-11-25 00:04:06 +0000 |
| commit | ca683d8ca54b7579eefba8ef52ccd35b04a66b63 (patch) | |
| tree | eaddb496c01c6bcb889b94724b5e206fd51a1ab6 /django/views | |
| parent | eff2a1fde278e9fb5577728550cd1650e4e65c42 (diff) | |
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
Diffstat (limited to 'django/views')
| -rw-r--r-- | django/views/debug.py | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/django/views/debug.py b/django/views/debug.py index 80af44343f..863651b538 100644 --- a/django/views/debug.py +++ b/django/views/debug.py @@ -12,7 +12,7 @@ def linebreak_iter(template_source): yield 0 p = template_source.find('\n') while p >= 0: - yield p + yield p+1 p = template_source.find('\n', p+1) yield len(template_source) + 1 @@ -23,18 +23,17 @@ def get_template_exception_info(exc_type, exc_value, tb): line = 0 upto = 0 source_lines = [] - linebreaks = izip(count(0), linebreak_iter(template_source)) - for num, next in linebreaks: + for num, next in enumerate(linebreak_iter(template_source)): if start >= upto and end <= next: line = num - before = escape(template_source[upto+1:start]) + before = escape(template_source[upto:start]) during = escape(template_source[start:end]) after = escape(template_source[end:next]) - source_lines.append( (num, escape(template_source[upto+1:next])) ) + source_lines.append( (num, escape(template_source[upto:next])) ) upto = next total = len(source_lines) - top = max(0, line - context_lines) + top = max(1, line - context_lines) bottom = min(total, line + 1 + context_lines) template_info = { @@ -323,7 +322,7 @@ TECHNICAL_500_TEMPLATE = """ <td>{{ template_info.before }}<span class="specific">{{ template_info.during }}</span>{{ template_info.after }}</td></tr> {% else %} <tr><th>{{ source_line.0 }}</th> - <td> {{ source_line.1 }}</td></tr> + <td>{{ source_line.1 }}</td></tr> {% endifequal %} {% endfor %} </table> |
