﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
2745	[patch] make modpython error handler not barf on errors	md@…	Adrian Holovaty	"I ran into situations where error handling broke because of mangeled errors resulting in ugly ""Internal  Server Error"" messages(see below). It turned out that {{{ModPythonRequest.__repr__()}}} is used when reporting errors and {{{ModPythonRequest.__repr__()}}} relies in too much being sane to do it's job. The patch at http://c0re.23.nu/c0de/misc/django-3764-error_reporting_error.diff basically uses inelegat but effective {{{ try: [...] except: [...] }}} blocks to avoid an error while error reporting.

Sampe Error:
{{{
Internal Server Error ...

[Sat Sep 16 12:14:51 2006] [error] [client 80.130.106.15] PythonHandler django.core.handlers.modpython: TemplateSyntaxError: Caught an exception while rendering: 'NoneType' object has no attribute 'split'

Original Traceback (most recent call last):
  File ""/usr/local/lib/python2.4/site-packages/Django-0.95-py2.4.egg/django/template/__init__.py"", line 704, in render_node
    result = node.render(context)
  File ""/usr/local/lib/python2.4/site-packages/Django-0.95-py2.4.egg/django/template/defaulttags.py"", line 189, in render
    value = bool_expr.resolve(context, True)
  File ""/usr/local/lib/python2.4/site-packages/Django-0.95-py2.4.egg/django/template/__init__.py"", line 550, in resolve
    obj = resolve_variable(self.var, context)
  File ""/usr/local/lib/python2.4/site-packages/Django-0.95-py2.4.egg/django/template/__init__.py"", line 655, in resolve_variable
    raise VariableDoesNotExist, ""Failed lookup for key [%s] in %r"" % (bits[0], current) # missing attribute
  File ""/usr/local/lib/python2.4/site-packages/Django-0.95-py2.4.egg/django/core/handlers/modpython.py"", line 19, in __repr__
    return '<ModPythonRequest\
path:%s,\
GET:%s,\
POST:%s,\
COOKIES:%s,\
META:%s>' % \\
  File ""/usr/local/lib/python2.4/site-packages/Django-0.95-py2.4.egg/django/core/handlers/modpython.py"", line 51, in _get_post
    self._load_post_and_files()
  File ""/usr/local/lib/python2.4/site-packages/Django-0.95-py2.4.egg/django/core/handlers/modpython.py"", line 32, in _load_post_and_files
    self._post, self._files = http.parse_file_upload(self._req.headers_in, self.raw_post_data)
  File ""/usr/local/lib/python2.4/site-packages/Django-0.95-py2.4.egg/django/http/__init__.py"", line 56, in parse_file_upload
    name_dict = parse_header(submessage['Content-Disposition'])[1]
  File ""/usr/local/lib/python2.4/cgi.py"", line 331, in parse_header
    plist = map(lambda x: x.strip(), line.split(';'))
AttributeError: 'NoneType' object has no attribute 'split'
, referer: [...]
}}}
"	defect	closed	Core (Other)	dev	normal	fixed		md@…	Unreviewed	1	0	0	0	0	0
