Skip to content

Commit

Permalink
fix: Adds a deprecation warning for SEND_BROKEN_LINK_EMAILS (#7420)
Browse files Browse the repository at this point in the history
* Fix:		toolbar bug 3.10.rc1

* Feat:	Dark mode support, including input from @marksweb, bugfix for tooltips

* Upstream change to be able to merge

* Feat: Dark mode support, including input from @marksweb, bugfix for tooltips

* Revert "Fix:		toolbar bug 3.10.rc1"

This reverts commit 592a2b6.

* Fix:		Recommit toolbar fix (??)

* Fix:		After lint failure: Remove spaces added by PyCharm

* Fix:		Wizzard button color

* Fix:		Correct toolbar according to cms_path
Fix:		Avoid unnecessary toolbar loading

* TASK: use isort to sort imports

* Fix:	Move CMS.API.Toolbar.get_color_scheme to CMS.API.Helpers.getColorScheme and CMS.API.Toolbar.set_color_scheme to CMS.API.Helpers.setColorScheme

* Fix:		Typo in comment

* Fix:		Typos in comments

* Fix:		Typos in comments

* Add:		Changelog entry

* Fix:		base unit test for js frontend

* Add:		Basic set/get color scheme test

* fix:	deprecate SEND_BROKEN_LINK_EMAILS setting

* fix: flake8 w504

Co-authored-by: Vinit Kumar <mail@vinitkumar.me>
Co-authored-by: Simon Krull <krull@punkt.de>
Co-authored-by: Mark Walker <theshow@gmail.com>
  • Loading branch information
4 people committed Nov 3, 2022
1 parent 3fe1449 commit d38f4a1
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 8 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,10 @@ unreleased
* Unlocalize page and node ids when rendering the page tree in the admin (#7175)
* Fixed permission denied error after page create (#6866)
* Improved performance when using CMS_RAW_ID_USERS=True on a Postgres DB with many users
* Deprecate usage of legacy SEND_BROKEN_LINK_EMAILS setting (removed since Django 1.8)
* Add deprecation warning to ``cms.utils.i18n.get_current_language()`` (#6720)


3.11.0 (2022-08-02)
===================

Expand Down
10 changes: 2 additions & 8 deletions cms/templatetags/cms_tags.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,9 @@
from django.contrib.sites.models import Site
from django.core.mail import mail_managers
from django.db.models import Model
from django.middleware.common import BrokenLinkEmailsMiddleware
from django.template.loader import render_to_string
from django.urls import reverse
from django.utils.encoding import force_str, smart_str
from django.utils.encoding import smart_str
from django.utils.html import escape
from django.utils.http import urlencode
from django.utils.translation import get_language, gettext_lazy as _, override as force_language
Expand Down Expand Up @@ -92,12 +91,7 @@ def _get_page_by_untyped_arg(page_lookup, request, site_id):
if getattr(settings, 'SEND_BROKEN_LINK_EMAILS', False):
mail_managers(subject, body, fail_silently=True)
elif 'django.middleware.common.BrokenLinkEmailsMiddleware' in mw:
middle = BrokenLinkEmailsMiddleware()
domain = request.get_host()
path = request.get_full_path()
referer = force_str(request.headers.get('Referer', ''), errors='replace')
if not middle.is_ignorable_request(request, path, domain, referer):
mail_managers(subject, body, fail_silently=True)
mail_managers(subject, body, fail_silently=True)
return None


Expand Down
10 changes: 10 additions & 0 deletions cms/utils/setup.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import warnings

from django.conf import settings
from django.core.exceptions import ImproperlyConfigured

Expand Down Expand Up @@ -33,6 +35,14 @@ def validate_settings():
raise ImproperlyConfigured("django CMS requires django.template.context_processors.request in "
"'django.template.backends.django.DjangoTemplates' context processors.")

if (
hasattr(settings, "SEND_BROKEN_LINK_EMAILS") and # noqa: W504
"django.middleware.common.BrokenLinkEmailsMiddleware" not in getattr(settings, "MIDDLEWARE", [])
):
warnings.warn('The setting "SEND_BROKEN_LINK_EMAILS" will not be honored by django CMS as of version 4.1. '
'Add "django.middleware.common.BrokenLinkEmailsMiddleware" to your MIDDLEWARE settings '
'instead.', DeprecationWarning)


def setup():
"""
Expand Down

0 comments on commit d38f4a1

Please sign in to comment.