From c7bd6679f559bfa3e4c0f1427940ae0314381b46 Mon Sep 17 00:00:00 2001 From: Soban Javed Date: Mon, 11 Oct 2021 15:17:52 +0500 Subject: [PATCH] fix: update samesite cookie settings name for Django 3.2 As django-cookies-samesite package is set to be removed from base requirements when we upgrade to Django 3.2, we should follow the settings name provided by Django. https://docs.djangoproject.com/en/3.2/ref/settings/#session-cookie-samesite --- lms/envs/production.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/lms/envs/production.py b/lms/envs/production.py index 63bc68d343..ca0fb39819 100644 --- a/lms/envs/production.py +++ b/lms/envs/production.py @@ -157,6 +157,12 @@ SESSION_COOKIE_HTTPONLY = ENV_TOKENS.get('SESSION_COOKIE_HTTPONLY', True) DCS_SESSION_COOKIE_SAMESITE = ENV_TOKENS.get('DCS_SESSION_COOKIE_SAMESITE', DCS_SESSION_COOKIE_SAMESITE) DCS_SESSION_COOKIE_SAMESITE_FORCE_ALL = ENV_TOKENS.get('DCS_SESSION_COOKIE_SAMESITE_FORCE_ALL', DCS_SESSION_COOKIE_SAMESITE_FORCE_ALL) # lint-amnesty, pylint: disable=line-too-long +# As django-cookies-samesite package is set to be removed from base requirements when we upgrade to Django 3.2, +# we should follow the settings name provided by Django. +# https://docs.djangoproject.com/en/3.2/ref/settings/#session-cookie-samesite +if django.VERSION >= (3, 1): + SESSION_COOKIE_SAMESITE = DCS_SESSION_COOKIE_SAMESITE + AWS_SES_REGION_NAME = ENV_TOKENS.get('AWS_SES_REGION_NAME', 'us-east-1') AWS_SES_REGION_ENDPOINT = ENV_TOKENS.get('AWS_SES_REGION_ENDPOINT', 'email.us-east-1.amazonaws.com')