diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 7b954392416..44ba54a9f6d 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -5,6 +5,9 @@ Changelog unreleased ========== +* Added dark mode support to css +* Fix publishing of static placeholders outside of CMS pages +* Allow to override the template rendered after a plugin has been saved. 3.10.0 (2022-03-26) =================== @@ -72,10 +75,6 @@ With the review help of the following contributors: Thanks to all contributors for their efforts! -* Added dark mode support to css -* Fix publishing of static placeholders outside of CMS pages -* Allow to override the template rendered after a plugin has been saved. - 3.9.0 (2021-06-30) ================== diff --git a/cms/middleware/language.py b/cms/middleware/language.py index f78a9c29511..0b471f58a02 100644 --- a/cms/middleware/language.py +++ b/cms/middleware/language.py @@ -2,6 +2,8 @@ from django.utils.deprecation import MiddlewareMixin from django.utils.translation import get_language +from cms.utils.compat import DJANGO_3_0 + class LanguageCookieMiddleware(MiddlewareMixin): def __init__(self, get_response): @@ -18,14 +20,21 @@ def __call__(self, request): # To ensure support of very old browsers, Django processed automatically "expires" according to max_age value. # https://docs.djangoproject.com/en/3.2/ref/request-response/#django.http.HttpResponse.set_cookie + cookie_kwargs = { + 'value': language, + 'domain': settings.LANGUAGE_COOKIE_DOMAIN, + 'max_age': settings.LANGUAGE_COOKIE_AGE or 365 * 24 * 60 * 60, # 1 year + 'path': settings.LANGUAGE_COOKIE_PATH, + } + if DJANGO_3_0: + cookie_kwargs.update({ + 'httponly': settings.LANGUAGE_COOKIE_HTTPONLY, + 'samesite': settings.LANGUAGE_COOKIE_SAMESITE, + 'secure': settings.LANGUAGE_COOKIE_SECURE, + }) + response.set_cookie( settings.LANGUAGE_COOKIE_NAME, - value=language, - domain=settings.LANGUAGE_COOKIE_DOMAIN, - max_age=settings.LANGUAGE_COOKIE_AGE or 365 * 24 * 60 * 60, # 1 year - httponly=settings.LANGUAGE_COOKIE_HTTPONLY, - path=settings.LANGUAGE_COOKIE_PATH, - samesite=settings.LANGUAGE_COOKIE_SAMESITE, - secure=settings.LANGUAGE_COOKIE_SECURE, + **cookie_kwargs ) return response diff --git a/cms/toolbar/toolbar.py b/cms/toolbar/toolbar.py index 8c9809a64e6..52e73294dd4 100644 --- a/cms/toolbar/toolbar.py +++ b/cms/toolbar/toolbar.py @@ -326,10 +326,10 @@ def get_object_draft_url(self): with force_language(self.request_language): try: return self.obj.get_draft_url() - except NoReverseMatch: + except (NoReverseMatch, AttributeError): try: return self.obj.get_absolute_url() - except NoReverseMatch: + except (NoReverseMatch, AttributeError): pass return '' diff --git a/docs/upgrade/3.10.0.rst b/docs/upgrade/3.10.0.rst index d019f96c15d..3fbd1df6866 100644 --- a/docs/upgrade/3.10.0.rst +++ b/docs/upgrade/3.10.0.rst @@ -49,7 +49,7 @@ Bug Fixes: * Fix styles issues, caused by switching to the ``display: flex`` on the page tree renderer. * Fixed missing builtin arguments on main ``cms`` management command causing it to crash * Fixed template label nested translation -* Fixed a bug where the fallback page title would be returned instead of the one from the current language +* Fixed a bug where the fallback page title would be returned instead of the one from the current language * Fixed an issue when running migrations on a multi database project