Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Fixed #1785 -- debug view no longer assumes _get_lines_from_file retu…

…rns None. Thanks, django@binaryfeed.org

git-svn-id: http://code.djangoproject.com/svn/django/trunk@2864 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit 885dd85b5f7f35cf3266c6552d77f5577bb66828 1 parent be0032f
@adrianholovaty adrianholovaty authored
Showing with 13 additions and 12 deletions.
  1. +13 −12 django/views/debug.py
View
25 django/views/debug.py
@@ -96,18 +96,19 @@ def technical_500_response(request, exc_type, exc_value, tb):
function = tb.tb_frame.f_code.co_name
lineno = tb.tb_lineno - 1
pre_context_lineno, pre_context, context_line, post_context = _get_lines_from_file(filename, lineno, 7)
- frames.append({
- 'tb': tb,
- 'filename': filename,
- 'function': function,
- 'lineno': lineno + 1,
- 'vars': tb.tb_frame.f_locals.items(),
- 'id': id(tb),
- 'pre_context': pre_context,
- 'context_line': context_line,
- 'post_context': post_context,
- 'pre_context_lineno': pre_context_lineno + 1,
- })
+ if pre_context_lineno:
+ frames.append({
+ 'tb': tb,
+ 'filename': filename,
+ 'function': function,
+ 'lineno': lineno + 1,
+ 'vars': tb.tb_frame.f_locals.items(),
+ 'id': id(tb),
+ 'pre_context': pre_context,
+ 'context_line': context_line,
+ 'post_context': post_context,
+ 'pre_context_lineno': pre_context_lineno + 1,
+ })
tb = tb.tb_next
t = Template(TECHNICAL_500_TEMPLATE)
Please sign in to comment.
Something went wrong with that request. Please try again.