Fixed super-edge-case bug in debug view where exc_value.args was empty. I managed to trigger this in some template code
git-svn-id: http://code.djangoproject.com/svn/django/trunk@17245 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
parent
287565779d
commit
98c974c70b
|
@ -302,8 +302,14 @@ class ExceptionReporter(object):
|
||||||
top = max(1, line - context_lines)
|
top = max(1, line - context_lines)
|
||||||
bottom = min(total, line + 1 + 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 = {
|
self.template_info = {
|
||||||
'message': self.exc_value.args[0],
|
'message': message,
|
||||||
'source_lines': source_lines[top:bottom],
|
'source_lines': source_lines[top:bottom],
|
||||||
'before': before,
|
'before': before,
|
||||||
'during': during,
|
'during': during,
|
||||||
|
|
Loading…
Reference in New Issue