1
0
mirror of https://github.com/django/django.git synced 2025-11-07 07:15:35 +00:00

Refs #28909 -- Simplifed code using unpacking generalizations.

This commit is contained in:
Mariusz Felisiak
2018-02-26 18:23:31 +01:00
committed by GitHub
parent 5b589a47b9
commit 074a2f7f58
8 changed files with 19 additions and 34 deletions

View File

@@ -30,7 +30,6 @@ class EngineHandler:
templates = OrderedDict()
backend_names = []
for tpl in self._templates:
tpl = tpl.copy()
try:
# This will raise an exception if 'BACKEND' doesn't exist or
# isn't a string containing at least one dot.
@@ -41,10 +40,13 @@ class EngineHandler:
"Invalid BACKEND for a template engine: {}. Check "
"your TEMPLATES setting.".format(invalid_backend))
tpl.setdefault('NAME', default_name)
tpl.setdefault('DIRS', [])
tpl.setdefault('APP_DIRS', False)
tpl.setdefault('OPTIONS', {})
tpl = {
'NAME': default_name,
'DIRS': [],
'APP_DIRS': False,
'OPTIONS': {},
**tpl,
}
templates[tpl['NAME']] = tpl
backend_names.append(tpl['NAME'])