debian: use MIDDLEWARE in debian_config_common.py (#36584)
This commit is contained in:
parent
4ed5d38e4c
commit
c178320985
|
@ -11,6 +11,7 @@
|
|||
import os
|
||||
import warnings
|
||||
|
||||
import django
|
||||
from django.conf import global_settings
|
||||
from django.core.exceptions import ImproperlyConfigured
|
||||
|
||||
|
@ -239,23 +240,39 @@ SESSION_ENGINE = 'mellon.sessions_backends.cached_db'
|
|||
# make it easier to use runserver behind nginx as reverse proxy
|
||||
SECURE_PROXY_SSL_HEADER = ('HTTP_X_FORWARDED_PROTO', 'https')
|
||||
|
||||
if not 'MIDDLEWARE_CLASSES' in globals():
|
||||
MIDDLEWARE_CLASSES = global_settings.MIDDLEWARE_CLASSES
|
||||
if 'MIDDLEWARE' not in globals():
|
||||
MIDDLEWARE = global_settings.MIDDLEWARE
|
||||
|
||||
MIDDLEWARE_CLASSES = (
|
||||
'hobo.middleware.VersionMiddleware', # /__version__
|
||||
'hobo.middleware.cors.CORSMiddleware',
|
||||
) + MIDDLEWARE_CLASSES
|
||||
if 'MIDDLEWARE_CLASSES' in globals():
|
||||
MIDDLEWARE_CLASSES = (
|
||||
'hobo.middleware.VersionMiddleware', # /__version__
|
||||
'hobo.middleware.cors.CORSMiddleware',
|
||||
) + MIDDLEWARE_CLASSES
|
||||
|
||||
if PROJECT_NAME != 'wcs' and 'authentic2' not in INSTALLED_APPS:
|
||||
MIDDLEWARE_CLASSES = MIDDLEWARE_CLASSES + (
|
||||
'mellon.middleware.PassiveAuthenticationMiddleware',
|
||||
)
|
||||
if PROJECT_NAME != 'wcs' and 'authentic2' not in INSTALLED_APPS:
|
||||
MIDDLEWARE_CLASSES = MIDDLEWARE_CLASSES + (
|
||||
'mellon.middleware.PassiveAuthenticationMiddleware',
|
||||
)
|
||||
|
||||
if 'authentic2' in INSTALLED_APPS:
|
||||
MIDDLEWARE_CLASSES = MIDDLEWARE_CLASSES + (
|
||||
'hobo.agent.authentic2.middleware.ProvisionningMiddleware',
|
||||
)
|
||||
if 'authentic2' in INSTALLED_APPS:
|
||||
MIDDLEWARE_CLASSES = MIDDLEWARE_CLASSES + (
|
||||
'hobo.agent.authentic2.middleware.ProvisionningMiddleware',
|
||||
)
|
||||
else:
|
||||
MIDDLEWARE = (
|
||||
'hobo.middleware.VersionMiddleware', # /__version__
|
||||
'hobo.middleware.cors.CORSMiddleware',
|
||||
) + MIDDLEWARE
|
||||
|
||||
if PROJECT_NAME != 'wcs' and 'authentic2' not in INSTALLED_APPS:
|
||||
MIDDLEWARE = MIDDLEWARE + (
|
||||
'mellon.middleware.PassiveAuthenticationMiddleware',
|
||||
)
|
||||
|
||||
if 'authentic2' in INSTALLED_APPS:
|
||||
MIDDLEWARE = MIDDLEWARE + (
|
||||
'hobo.agent.authentic2.middleware.ProvisionningMiddleware',
|
||||
)
|
||||
|
||||
|
||||
if PROJECT_NAME != 'wcs':
|
||||
|
@ -264,9 +281,14 @@ if PROJECT_NAME != 'wcs':
|
|||
TENANT_BASE = os.path.join(VAR_DIR, 'tenants')
|
||||
TENANT_MODEL = 'multitenant.Tenant'
|
||||
|
||||
MIDDLEWARE_CLASSES = (
|
||||
'hobo.multitenant.middleware.TenantMiddleware',
|
||||
) + MIDDLEWARE_CLASSES
|
||||
if 'MIDDLEWARE_CLASSES' in globals():
|
||||
MIDDLEWARE_CLASSES = (
|
||||
'hobo.multitenant.middleware.TenantMiddleware',
|
||||
) + MIDDLEWARE_CLASSES
|
||||
else:
|
||||
MIDDLEWARE = (
|
||||
'hobo.multitenant.middleware.TenantMiddleware',
|
||||
) + MIDDLEWARE
|
||||
|
||||
DATABASES = {
|
||||
'default': {
|
||||
|
@ -334,13 +356,23 @@ if 'authentic2' not in INSTALLED_APPS:
|
|||
MELLON_OPENED_SESSION_COOKIE_NAME = 'A2_OPENED_SESSION'
|
||||
MELLON_ADD_AUTHNREQUEST_NEXT_URL_EXTENSION = True
|
||||
|
||||
MIDDLEWARE_CLASSES = (
|
||||
'hobo.middleware.utils.StoreRequestMiddleware',
|
||||
'hobo.middleware.xforwardedfor.XForwardedForMiddleware',
|
||||
) + MIDDLEWARE_CLASSES
|
||||
if 'MIDDLEWARE_CLASSES' in globals():
|
||||
MIDDLEWARE_CLASSES = (
|
||||
'hobo.middleware.utils.StoreRequestMiddleware',
|
||||
'hobo.middleware.xforwardedfor.XForwardedForMiddleware',
|
||||
) + MIDDLEWARE_CLASSES
|
||||
|
||||
MIDDLEWARE_CLASSES = MIDDLEWARE_CLASSES + (
|
||||
'hobo.middleware.PrometheusStatsMiddleware',)
|
||||
else:
|
||||
MIDDLEWARE = (
|
||||
'hobo.middleware.utils.StoreRequestMiddleware',
|
||||
'hobo.middleware.xforwardedfor.XForwardedForMiddleware',
|
||||
) + MIDDLEWARE
|
||||
|
||||
MIDDLEWARE = MIDDLEWARE + (
|
||||
'hobo.middleware.PrometheusStatsMiddleware',)
|
||||
|
||||
MIDDLEWARE_CLASSES = MIDDLEWARE_CLASSES + (
|
||||
'hobo.middleware.PrometheusStatsMiddleware',)
|
||||
|
||||
HOBO_MANAGER_HOMEPAGE_URL_VAR = 'portal_agent_url'
|
||||
HOBO_MANAGER_HOMEPAGE_TITLE_VAR = 'portal_agent_title'
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
import os
|
||||
|
||||
import os.path
|
||||
import __builtin__ as builtin
|
||||
from mock import mock_open, patch
|
||||
|
@ -9,15 +11,26 @@ INSTALLED_APPS = ('django.contrib.auth', 'django.contrib.sessions', 'django.cont
|
|||
|
||||
PROJECT_NAME = 'fake-agent'
|
||||
|
||||
MIDDLEWARE_CLASSES = (
|
||||
'django.contrib.sessions.middleware.SessionMiddleware',
|
||||
'django.middleware.locale.LocaleMiddleware',
|
||||
'django.middleware.common.CommonMiddleware',
|
||||
'django.middleware.csrf.CsrfViewMiddleware',
|
||||
'django.contrib.auth.middleware.AuthenticationMiddleware',
|
||||
'django.contrib.messages.middleware.MessageMiddleware',
|
||||
'django.middleware.clickjacking.XFrameOptionsMiddleware',
|
||||
)
|
||||
if 'OLD_STYLE_MIDDLEWARE' in os.environ:
|
||||
MIDDLEWARE_CLASSES = (
|
||||
'django.contrib.sessions.middleware.SessionMiddleware',
|
||||
'django.middleware.locale.LocaleMiddleware',
|
||||
'django.middleware.common.CommonMiddleware',
|
||||
'django.middleware.csrf.CsrfViewMiddleware',
|
||||
'django.contrib.auth.middleware.AuthenticationMiddleware',
|
||||
'django.contrib.messages.middleware.MessageMiddleware',
|
||||
'django.middleware.clickjacking.XFrameOptionsMiddleware',
|
||||
)
|
||||
else:
|
||||
MIDDLEWARE = (
|
||||
'django.contrib.sessions.middleware.SessionMiddleware',
|
||||
'django.middleware.locale.LocaleMiddleware',
|
||||
'django.middleware.common.CommonMiddleware',
|
||||
'django.middleware.csrf.CsrfViewMiddleware',
|
||||
'django.contrib.auth.middleware.AuthenticationMiddleware',
|
||||
'django.contrib.messages.middleware.MessageMiddleware',
|
||||
'django.middleware.clickjacking.XFrameOptionsMiddleware',
|
||||
)
|
||||
|
||||
TEMPLATES = [
|
||||
{
|
||||
|
|
3
tox.ini
3
tox.ini
|
@ -4,7 +4,7 @@
|
|||
# and then run "tox" from this directory.
|
||||
[tox]
|
||||
toxworkdir = {env:TMPDIR:/tmp}/tox-{env:USER}/hobo
|
||||
envlist = coverage-{authentic,hobo,multipublik,multitenant,passerelle,schemas},
|
||||
envlist = coverage-{authentic,hobo,multipublik,multitenant{,-oldstylemiddleware},passerelle,schemas},
|
||||
|
||||
[testenv]
|
||||
basepython = python2
|
||||
|
@ -29,6 +29,7 @@ setenv =
|
|||
passerelle: DJANGO_SETTINGS_MODULE=passerelle.settings
|
||||
coverage: COVERAGE=--junitxml=junit-{envname}.xml --cov-report xml --cov-report html --cov=hobo/ --cov-config .coveragerc
|
||||
fast: NOMIGRATIONS=--nomigrations
|
||||
oldstylemiddleware: OLD_STYLE_MIDDLEWARE=true
|
||||
deps:
|
||||
pytest
|
||||
pytest-cov
|
||||
|
|
Loading…
Reference in New Issue