Author: adrian
Date: 2011-12-22 14:08:32 -0800 (Thu, 22 Dec 2011)
New Revision: 17245

Modified:
   django/trunk/django/views/debug.py
Log:
Fixed super-edge-case bug in debug view where exc_value.args was empty. I 
managed to trigger this in some template code

Modified: django/trunk/django/views/debug.py
===================================================================
--- django/trunk/django/views/debug.py  2011-12-22 20:42:40 UTC (rev 17244)
+++ django/trunk/django/views/debug.py  2011-12-22 22:08:32 UTC (rev 17245)
@@ -302,8 +302,14 @@
         top = max(1, line - context_lines)
         bottom = min(total, line + 1 + context_lines)
 
+        # In some rare cases, exc_value.args might be empty.
+        try:
+            message = self.exc_value.args[0]
+        except IndexError:
+            message = '(Could not get exception message)'
+
         self.template_info = {
-            'message': self.exc_value.args[0],
+            'message': message,
             'source_lines': source_lines[top:bottom],
             'before': before,
             'during': during,

-- 
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?hl=en.

Reply via email to