diff options
| author | Adrian Holovaty <adrian@holovaty.com> | 2005-10-15 02:20:35 +0000 |
|---|---|---|
| committer | Adrian Holovaty <adrian@holovaty.com> | 2005-10-15 02:20:35 +0000 |
| commit | a2e26150b77cd2cdad4cc9de120a87a6370c6dd5 (patch) | |
| tree | 669936b4c04c22eae6e6e71aa3fad66f2a5e4693 /django/utils | |
| parent | 24154b216682dfef7ff647a5c2f698b89ba429a6 (diff) | |
Fixed #616 -- Added a process_exception() hook to middleware framework. Thanks, Hugo
git-svn-id: http://code.djangoproject.com/svn/django/trunk@880 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'django/utils')
| -rw-r--r-- | django/utils/decorators.py | 9 |
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: |
