diff options
| author | Aymeric Augustin <aymeric.augustin@m4x.org> | 2015-02-05 11:38:58 +0100 |
|---|---|---|
| committer | Aymeric Augustin <aymeric.augustin@m4x.org> | 2015-02-05 20:09:10 +0100 |
| commit | 67787db22a3d684ce2800c80fca477af1684deab (patch) | |
| tree | 3c6ec1296a612ecffcf446be9e2201b521ddaccd /django/views/debug.py | |
| parent | 5fbec369aa32d1717b7bffc169649ab5896a7ad9 (diff) | |
[1.8.x] Caught all exceptions raised by Engine.get_default().
In addition to ImproperlyConfigured, Engine.get_default() may also raise
ImportError or other exceptions. It's better to catch all exceptions in
places where the default engine isn't strictly required.
Backport of 27f9ff45 from master
Diffstat (limited to 'django/views/debug.py')
| -rw-r--r-- | django/views/debug.py | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/django/views/debug.py b/django/views/debug.py index 03387efaaf..19254c5cf2 100644 --- a/django/views/debug.py +++ b/django/views/debug.py @@ -7,7 +7,6 @@ import sys import types from django.conf import settings -from django.core.exceptions import ImproperlyConfigured from django.core.urlresolvers import resolve, Resolver404 from django.http import (HttpResponse, HttpResponseNotFound, HttpRequest, build_request_repr) @@ -282,7 +281,11 @@ class ExceptionReporter(object): """Return a dictionary containing traceback information.""" try: default_template_engine = Engine.get_default() - except ImproperlyConfigured: + except Exception: + # Since the debug view must never crash, catch all exceptions. + # If Django can't find a default template engine, get_default() + # raises ImproperlyConfigured. If some template engines fail to + # load, any exception may be raised. default_template_engine = None # TODO: add support for multiple template engines (#24120). |
