Skip to content

Commit be272a0

Browse files
committed
Changed settings to use the new TEMPLATES dictionary instead of the deprecated individual TEMPLATE_* settings.
- Legacy-Id: 12444
1 parent cec0f33 commit be272a0

1 file changed

Lines changed: 36 additions & 29 deletions

File tree

ietf/settings.py

Lines changed: 36 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121
import debug
2222

2323
DEBUG = True
24-
TEMPLATE_DEBUG = DEBUG
2524
debug.debug = DEBUG
2625

2726
# Valid values:
@@ -216,13 +215,38 @@ def skip_unreadable_post(record):
216215

217216
PREFERENCES_COOKIE_AGE = 60 * 60 * 24 * 365 * 50 # Age of cookie, in seconds: 50 years
218217

219-
TEMPLATE_LOADERS = (
220-
('django.template.loaders.cached.Loader', (
221-
'django.template.loaders.filesystem.Loader',
222-
'django.template.loaders.app_directories.Loader',
223-
)),
224-
'ietf.dbtemplate.template.Loader',
225-
)
218+
TEMPLATES = [
219+
{
220+
'BACKEND': 'django.template.backends.django.DjangoTemplates',
221+
'DIRS': [
222+
BASE_DIR + "/templates",
223+
BASE_DIR + "/secr/templates",
224+
],
225+
'OPTIONS': {
226+
'context_processors': [
227+
'django.contrib.auth.context_processors.auth',
228+
'django.template.context_processors.debug',
229+
'django.template.context_processors.i18n',
230+
'django.template.context_processors.request',
231+
'django.template.context_processors.media',
232+
#'django.template.context_processors.tz',
233+
'django.contrib.messages.context_processors.messages',
234+
'ietf.context_processors.server_mode',
235+
'ietf.context_processors.debug_mark_queries_from_view',
236+
'ietf.context_processors.revision_info',
237+
'ietf.secr.context_processors.secr_revision_info',
238+
'ietf.context_processors.rfcdiff_base_url',
239+
],
240+
'loaders': [
241+
('django.template.loaders.cached.Loader', (
242+
'django.template.loaders.filesystem.Loader',
243+
'django.template.loaders.app_directories.Loader',
244+
)),
245+
'ietf.dbtemplate.template.Loader',
246+
]
247+
},
248+
},
249+
]
226250

227251
MIDDLEWARE_CLASSES = (
228252
'django.middleware.csrf.CsrfViewMiddleware',
@@ -240,25 +264,6 @@ def skip_unreadable_post(record):
240264

241265
ROOT_URLCONF = 'ietf.urls'
242266

243-
TEMPLATE_DIRS = (
244-
BASE_DIR + "/templates",
245-
BASE_DIR + "/secr/templates",
246-
)
247-
248-
TEMPLATE_CONTEXT_PROCESSORS = (
249-
'django.contrib.auth.context_processors.auth',
250-
'django.core.context_processors.debug',
251-
'django.core.context_processors.i18n',
252-
'django.core.context_processors.request',
253-
'django.core.context_processors.media',
254-
'django.contrib.messages.context_processors.messages',
255-
'ietf.context_processors.server_mode',
256-
'ietf.context_processors.debug_mark_queries_from_view',
257-
'ietf.context_processors.revision_info',
258-
'ietf.secr.context_processors.secr_revision_info',
259-
'ietf.context_processors.rfcdiff_base_url',
260-
)
261-
262267
# Additional locations of static files (in addition to each app's static/ dir)
263268
STATICFILES_DIRS = (
264269
os.path.join(BASE_DIR, 'static'),
@@ -755,7 +760,7 @@ def skip_unreadable_post(record):
755760
# Add DEV_APPS to INSTALLED_APPS
756761
INSTALLED_APPS += DEV_APPS
757762
MIDDLEWARE_CLASSES += DEV_MIDDLEWARE_CLASSES
758-
TEMPLATE_CONTEXT_PROCESSORS += DEV_TEMPLATE_CONTEXT_PROCESSORS
763+
TEMPLATES[0]['OPTIONS']['context_processors'] += DEV_TEMPLATE_CONTEXT_PROCESSORS
759764

760765

761766
# We provide a secret key only for test and development modes. It's
@@ -764,7 +769,9 @@ def skip_unreadable_post(record):
764769
# publicly available, for instance from the source repository.
765770
if SERVER_MODE != 'production':
766771
# stomp out the cached template loader, it's annoying
767-
TEMPLATE_LOADERS = tuple(l for e in TEMPLATE_LOADERS for l in (e[1] if isinstance(e, tuple) and "cached.Loader" in e[0] else (e,)))
772+
loaders = TEMPLATES[0]['OPTIONS']['loaders']
773+
loaders = tuple(l for e in loaders for l in (e[1] if isinstance(e, tuple) and "cached.Loader" in e[0] else (e,)))
774+
TEMPLATES[0]['OPTIONS']['loaders'] = loaders
768775

769776
CACHES = {
770777
'default': {

0 commit comments

Comments
 (0)