summaryrefslogtreecommitdiff
path: root/django/utils
diff options
context:
space:
mode:
Diffstat (limited to 'django/utils')
-rw-r--r--django/utils/decorators.py9
1 files changed, 8 insertions, 1 deletions
diff --git a/django/utils/decorators.py b/django/utils/decorators.py
index 1333f9da88..074532e741 100644
--- a/django/utils/decorators.py
+++ b/django/utils/decorators.py
@@ -16,7 +16,14 @@ def decorator_from_middleware(middleware_class):
result = middleware.process_view(request, view_func, **kwargs)
if result is not None:
return result
- response = view_func(request, *args, **kwargs)
+ try:
+ response = view_func(request, *args, **kwargs)
+ except Exception, e:
+ if hasattr(middleware, 'process_exception'):
+ result = middleware.process_exception(request, e)
+ if result is not None:
+ return result
+ raise e
if hasattr(middleware, 'process_response'):
result = middleware.process_response(request, response)
if result is not None: