debian: remove template compat with django < 1.10 from shared config (#62275)

This commit is contained in:
Frédéric Péters 2022-03-01 08:47:28 +01:00
parent bd178920aa
commit 5abcc6d2b4
1 changed files with 18 additions and 39 deletions

View File

@ -223,48 +223,27 @@ VAR_DIR = '/var/lib/%s' % PROJECT_NAME
STATIC_ROOT = os.path.join(VAR_DIR, 'collectstatic')
# template settings
if 'TEMPLATE_DEBUG' in globals():
# compatibility with django<1.10
if PROJECT_NAME != 'wcs':
TEMPLATE_LOADERS = (
'hobo.multitenant.template_loader.FilesystemLoader',
) + global_settings.TEMPLATE_LOADERS
assert len(TEMPLATES)
assert TEMPLATES[0]['BACKEND'] == 'django.template.backends.django.DjangoTemplates'
if not 'TEMPLATE_CONTEXT_PROCESSORS' in globals():
TEMPLATE_CONTEXT_PROCESSORS = global_settings.TEMPLATE_CONTEXT_PROCESSORS
if not 'loaders' in TEMPLATES[0]['OPTIONS']:
TEMPLATES[0]['APP_DIRS'] = False
TEMPLATES[0]['OPTIONS']['loaders'] = [
'django.template.loaders.filesystem.Loader',
'django.template.loaders.app_directories.Loader',
]
if PROJECT_NAME != 'wcs':
TEMPLATES[0]['OPTIONS']['loaders'].insert(0, 'hobo.multitenant.template_loader.FilesystemLoader')
if not 'django.core.context_processors.request' in TEMPLATE_CONTEXT_PROCESSORS:
TEMPLATE_CONTEXT_PROCESSORS = (
'django.core.context_processors.request',
) + TEMPLATE_CONTEXT_PROCESSORS
TEMPLATE_CONTEXT_PROCESSORS = (
'hobo.context_processors.template_vars',
'hobo.context_processors.theme_base',
'hobo.context_processors.portal_agent_url',
'hobo.context_processors.user_urls',
) + TEMPLATE_CONTEXT_PROCESSORS
else:
assert len(TEMPLATES)
assert TEMPLATES[0]['BACKEND'] == 'django.template.backends.django.DjangoTemplates'
if not 'django.template.context_processors.request' in TEMPLATES[0]['OPTIONS']['context_processors']:
TEMPLATES[0]['OPTIONS']['context_processors'].insert(0, 'django.template.context_processors.request')
if not 'loaders' in TEMPLATES[0]['OPTIONS']:
TEMPLATES[0]['APP_DIRS'] = False
TEMPLATES[0]['OPTIONS']['loaders'] = [
'django.template.loaders.filesystem.Loader',
'django.template.loaders.app_directories.Loader',
]
if PROJECT_NAME != 'wcs':
TEMPLATES[0]['OPTIONS']['loaders'].insert(0, 'hobo.multitenant.template_loader.FilesystemLoader')
if not 'django.template.context_processors.request' in TEMPLATES[0]['OPTIONS']['context_processors']:
TEMPLATES[0]['OPTIONS']['context_processors'].insert(0, 'django.template.context_processors.request')
TEMPLATES[0]['OPTIONS']['context_processors'] = [
'hobo.context_processors.template_vars',
'hobo.context_processors.theme_base',
'hobo.context_processors.portal_agent_url',
'hobo.context_processors.user_urls',
] + TEMPLATES[0]['OPTIONS']['context_processors']
TEMPLATES[0]['OPTIONS']['context_processors'] = [
'hobo.context_processors.template_vars',
'hobo.context_processors.theme_base',
'hobo.context_processors.portal_agent_url',
'hobo.context_processors.user_urls',
] + TEMPLATES[0]['OPTIONS']['context_processors']
# needed by hobo.context_processors.theme_base:
# THEME_SKELETON_URL = 'https://www.example.net/__skeleton__'