Kaydet (Commit) 2c443df3 authored tarafından Adrian Holovaty's avatar Adrian Holovaty

Fixed #894 -- Moved response middleware call to base.py so that exceptions in…

Fixed #894 -- Moved response middleware call to base.py so that exceptions in that middleware get processed by the standard exception handling. As a nice side effect, this cuts down on a bit of redundant code.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@2358 bcc190cf-cafb-0310-a4f2-bffc1f526a37
üst 53ca15cd
......@@ -86,6 +86,10 @@ class BaseHandler:
if response is None:
raise ValueError, "The view %s.%s didn't return an HttpResponse object." % (callback.__module__, callback.func_name)
# Apply response middleware
for middleware_method in self._response_middleware:
response = middleware_method(request, response)
return response
except exceptions.Http404, e:
if DEBUG:
......
......@@ -144,10 +144,6 @@ class ModPythonHandler(BaseHandler):
finally:
db.db.close()
# Apply response middleware
for middleware_method in self._response_middleware:
response = middleware_method(request, response)
# Convert our custom HttpResponse object back into the mod_python req.
populate_apache_request(response, req)
return 0 # mod_python.apache.OK
......
......@@ -160,10 +160,6 @@ class WSGIHandler(BaseHandler):
finally:
db.db.close()
# Apply response middleware
for middleware_method in self._response_middleware:
response = middleware_method(request, response)
try:
status_text = STATUS_CODE_TEXT[response.status_code]
except KeyError:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment