1
0
mirror of https://github.com/django/django.git synced 2025-10-28 08:06:09 +00:00

[1.8.x] Fixed #24265 -- Preserved template backend loading exceptions.

If importing or initializing a template backend fails, attempting to
access this template backend again must raise the same exception.

Backport of 44ad6915 from master
This commit is contained in:
Aymeric Augustin
2015-02-05 11:53:04 +01:00
parent 67787db22a
commit aed1b1f6e5
2 changed files with 41 additions and 0 deletions

View File

@@ -90,6 +90,10 @@ class EngineHandler(object):
"Could not find config for '{}' "
"in settings.TEMPLATES".format(alias))
# If importing or initializing the backend raises an exception,
# self._engines[alias] isn't set and this code may get executed
# again, so we must preserve the original params. See #24265.
params = params.copy()
backend = params.pop('BACKEND')
engine_cls = import_string(backend)
engine = engine_cls(params)