Author: adrian
Date: 2006-05-06 18:18:22 -0500 (Sat, 06 May 2006)
New Revision: 2864

Modified:
   django/trunk/django/views/debug.py
Log:
Fixed #1785 -- debug view no longer assumes _get_lines_from_file returns None. 
Thanks, [EMAIL PROTECTED]

Modified: django/trunk/django/views/debug.py
===================================================================
--- django/trunk/django/views/debug.py  2006-05-06 23:16:43 UTC (rev 2863)
+++ django/trunk/django/views/debug.py  2006-05-06 23:18:22 UTC (rev 2864)
@@ -96,18 +96,19 @@
         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)


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-updates
-~----------~----~----~----~------~----~------~--~---

Reply via email to