diff --git a/django/views/debug.py b/django/views/debug.py
index eb610b7..0d325ad 100644
a
|
b
|
class ExceptionReporter(object):
|
427 | 427 | |
428 | 428 | return lower_bound, pre_context, context_line, post_context |
429 | 429 | |
| 430 | def context_text(self, num, context): |
| 431 | text = "" |
| 432 | for item in context: |
| 433 | text+=str(num)+". "+item+"\n" |
| 434 | num+=1 |
| 435 | |
| 436 | return text |
| 437 | |
430 | 438 | def get_traceback_frames(self): |
431 | 439 | frames = [] |
432 | 440 | tb = self.tb |
… |
… |
class ExceptionReporter(object):
|
442 | 450 | loader = tb.tb_frame.f_globals.get('__loader__') |
443 | 451 | module_name = tb.tb_frame.f_globals.get('__name__') or '' |
444 | 452 | pre_context_lineno, pre_context, context_line, post_context = self._get_lines_from_file(filename, lineno, 7, loader, module_name) |
| 453 | pre_context_text = self.context_text(pre_context_lineno+1, pre_context) |
| 454 | post_context_text = self.context_text(lineno+1, post_context) |
| 455 | context_line+="\n" |
445 | 456 | if pre_context_lineno is not None: |
446 | 457 | frames.append({ |
447 | 458 | 'tb': tb, |
… |
… |
class ExceptionReporter(object):
|
452 | 463 | 'vars': self.filter.get_traceback_frame_variables(self.request, tb.tb_frame), |
453 | 464 | 'id': id(tb), |
454 | 465 | 'pre_context': pre_context, |
| 466 | 'pre_context_text': pre_context_text, |
455 | 467 | 'context_line': context_line, |
456 | 468 | 'post_context': post_context, |
| 469 | 'post_context_text': post_context_text, |
457 | 470 | 'pre_context_lineno': pre_context_lineno + 1, |
458 | 471 | }) |
459 | 472 | tb = tb.tb_next |
… |
… |
In template {{ template_info.name }}, error at line {{ template_info.line }}
|
1026 | 1039 | {% endifequal %}{% endfor %}{% endif %}{% if frames %} |
1027 | 1040 | Traceback: |
1028 | 1041 | {% for frame in frames %}File "{{ frame.filename }}" in {{ frame.function }} |
1029 | | {% if frame.context_line %} {{ frame.lineno }}. {{ frame.context_line }}{% endif %} |
| 1042 | {% if frame.pre_context_text and not is_email %}{{ frame.pre_context_text }}{% endif %} |
| 1043 | {% if frame.context_line %}{{ frame.lineno }}. {{ frame.context_line }}{% endif %} |
| 1044 | {% if frame.post_context_text and not is_email %}{{ frame.post_context_text }}{% endif %} |
1030 | 1045 | {% endfor %} |
| 1046 | {% if lastframe %}Exception Location: {{ lastframe.filename }} in {{ lastframe.function }}, line {{ lastframe.lineno }}{% endif %} |
1031 | 1047 | {% if exception_type %}Exception Type: {{ exception_type }}{% if request %} at {{ request.path_info }}{% endif %} |
1032 | 1048 | {% if exception_value %}Exception Value: {{ exception_value }}{% endif %}{% endif %}{% endif %} |
| 1049 | {% if unicode_hint %}Unicode Error Hint: {{ unicode_hint }}{% endif %} |
1033 | 1050 | {% if request %}Request information: |
1034 | 1051 | GET:{% for k, v in request.GET.items %} |
1035 | 1052 | {{ k }} = {{ v|stringformat:"r" }}{% empty %} No GET data{% endfor %} |