Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

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
Adrian Holovaty authored May 06, 2006

Showing 1 changed file with 13 additions and 12 deletions. Show diff stats Hide diff stats

  1. 25  django/views/debug.py
25  django/views/debug.py
@@ -96,18 +96,19 @@ def technical_500_response(request, exc_type, exc_value, tb):
96 96
         function = tb.tb_frame.f_code.co_name
97 97
         lineno = tb.tb_lineno - 1
98 98
         pre_context_lineno, pre_context, context_line, post_context = _get_lines_from_file(filename, lineno, 7)
99  
-        frames.append({
100  
-            'tb': tb,
101  
-            'filename': filename,
102  
-            'function': function,
103  
-            'lineno': lineno + 1,
104  
-            'vars': tb.tb_frame.f_locals.items(),
105  
-            'id': id(tb),
106  
-            'pre_context': pre_context,
107  
-            'context_line': context_line,
108  
-            'post_context': post_context,
109  
-            'pre_context_lineno': pre_context_lineno + 1,
110  
-        })
  99
+        if pre_context_lineno:
  100
+            frames.append({
  101
+                'tb': tb,
  102
+                'filename': filename,
  103
+                'function': function,
  104
+                'lineno': lineno + 1,
  105
+                'vars': tb.tb_frame.f_locals.items(),
  106
+                'id': id(tb),
  107
+                'pre_context': pre_context,
  108
+                'context_line': context_line,
  109
+                'post_context': post_context,
  110
+                'pre_context_lineno': pre_context_lineno + 1,
  111
+            })
111 112
         tb = tb.tb_next
112 113
 
113 114
     t = Template(TECHNICAL_500_TEMPLATE)

0 notes on commit 885dd85

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