
# Various methods which interact on the settings. Moved here to make sure they
# are executed after the various overrides have happened, like for example
# in `91-local.conf`. In general this file shouldn't be touched.

# Languages
gettext = lambda s: s
# The default language should always be there
LANGUAGES.append((LANGUAGE_CODE, gettext(LANGUAGE_NAME)))
# Remove any duplicated entries and sort
LANGUAGES = list(set(LANGUAGES))
LANGUAGES.sort()

# If caching is enabled, the necessary middleware needs to be used.
# Middleware which needs to be at the beginning:
CACHE_MID = {'FIRST': 'django.middleware.cache.UpdateCacheMiddleware',
             'LAST': 'django.middleware.cache.FetchFromCacheMiddleware'}
if CACHES and 'default' in CACHES:
    if not CACHE_MID['FIRST'] in MIDDLEWARE_CLASSES:
        MIDDLEWARE_CLASSES.insert(0, CACHE_MID['FIRST'])
    if not CACHE_MID['LAST'] in MIDDLEWARE_CLASSES:
        MIDDLEWARE_CLASSES.append(CACHE_MID['LAST'])


