Commit ab146154 by Will Daly

Moved CSRF override into its own settings file

parent 39030c66
......@@ -126,14 +126,6 @@ LOGGING = get_logger_config(LOG_DIR,
#theming start:
PLATFORM_NAME = ENV_TOKENS.get('PLATFORM_NAME', 'edX')
# Disable CSRF for load testing
if MITX_FEATURES.get('AUTOMATIC_AUTH_FOR_LOAD_TESTING'):
exclude_csrf = lambda elem: not elem in \
['django.core.context_processors.csrf',
'django.middleware.csrf.CsrfViewMiddleware']
TEMPLATE_CONTEXT_PROCESSORS = filter(exclude_csrf, TEMPLATE_CONTEXT_PROCESSORS)
MIDDLEWARE_CLASSES = filter(exclude_csrf, MIDDLEWARE_CLASSES)
################ SECURE AUTH ITEMS ###############################
# Secret things: passwords, access keys, etc.
......
......@@ -182,15 +182,6 @@ SEGMENT_IO_KEY = os.environ.get('SEGMENT_IO_KEY')
if SEGMENT_IO_KEY:
MITX_FEATURES['SEGMENT_IO'] = True
########################## LOAD TESTING ########################
# Disable CSRF for load testing
if MITX_FEATURES.get('AUTOMATIC_AUTH_FOR_LOAD_TESTING'):
exclude_csrf = lambda elem: not elem in \
['django.core.context_processors.csrf',
'django.middleware.csrf.CsrfViewMiddleware']
TEMPLATE_CONTEXT_PROCESSORS = filter(exclude_csrf, TEMPLATE_CONTEXT_PROCESSORS)
MIDDLEWARE_CLASSES = filter(exclude_csrf, MIDDLEWARE_CLASSES)
#####################################################################
# Lastly, see if the developer has any local overrides.
......
......@@ -10,6 +10,7 @@ Common traits:
# We intentionally define lots of variables that aren't used, and
# want to import all variables from base settings files
# pylint: disable=W0401, W0614
import json
from .common import *
......@@ -177,15 +178,6 @@ for name, value in ENV_TOKENS.get("CODE_JAIL", {}).items():
COURSES_WITH_UNSAFE_CODE = ENV_TOKENS.get("COURSES_WITH_UNSAFE_CODE", [])
# Disable CSRF for load testing
if MITX_FEATURES.get('AUTOMATIC_AUTH_FOR_LOAD_TESTING'):
exclude_csrf = lambda elem: not elem in \
['django.core.context_processors.csrf',
'django.middleware.csrf.CsrfViewMiddleware']
TEMPLATE_CONTEXT_PROCESSORS = filter(exclude_csrf, TEMPLATE_CONTEXT_PROCESSORS)
MIDDLEWARE_CLASSES = filter(exclude_csrf, MIDDLEWARE_CLASSES)
############################## SECURE AUTH ITEMS ###############
# Secret things: passwords, access keys, etc.
......
......@@ -255,15 +255,6 @@ SEGMENT_IO_LMS_KEY = os.environ.get('SEGMENT_IO_LMS_KEY')
if SEGMENT_IO_LMS_KEY:
MITX_FEATURES['SEGMENT_IO_LMS'] = True
########################## LOAD TESTING ########################
# Disable CSRF for load testing
if MITX_FEATURES.get('AUTOMATIC_AUTH_FOR_LOAD_TESTING'):
exclude_csrf = lambda elem: not elem in \
['django.core.context_processors.csrf',
'django.middleware.csrf.CsrfViewMiddleware']
TEMPLATE_CONTEXT_PROCESSORS = filter(exclude_csrf, TEMPLATE_CONTEXT_PROCESSORS)
MIDDLEWARE_CLASSES = filter(exclude_csrf, MIDDLEWARE_CLASSES)
########################## USER API ########################
EDX_API_KEY = None
......
# Settings for load testing
from .aws import *
# Disable CSRF for load testing
if MITX_FEATURES.get('AUTOMATIC_AUTH_FOR_LOAD_TESTING'):
exclude_csrf = lambda elem: not elem in \
['django.core.context_processors.csrf',
'django.middleware.csrf.CsrfViewMiddleware']
TEMPLATE_CONTEXT_PROCESSORS = filter(exclude_csrf, TEMPLATE_CONTEXT_PROCESSORS)
MIDDLEWARE_CLASSES = filter(exclude_csrf, MIDDLEWARE_CLASSES)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment