diff --git a/django/conf/global_settings.py b/django/conf/global_settings.py index 76a6d6de574..2ced8107a68 100644 --- a/django/conf/global_settings.py +++ b/django/conf/global_settings.py @@ -168,9 +168,6 @@ FILE_CHARSET = 'utf-8' # Email address that error messages come from. SERVER_EMAIL = 'root@localhost' -# Whether to send broken-link emails. Deprecated, must be removed in 1.8. -SEND_BROKEN_LINK_EMAILS = False - # Database connection info. If left empty, will default to the dummy backend. DATABASES = {} diff --git a/django/middleware/common.py b/django/middleware/common.py index ce17a02c9c2..c719f9e9a33 100644 --- a/django/middleware/common.py +++ b/django/middleware/common.py @@ -1,13 +1,11 @@ import hashlib import logging import re -import warnings from django.conf import settings from django.core.mail import mail_managers from django.core import urlresolvers from django import http -from django.utils.deprecation import RemovedInDjango18Warning from django.utils.encoding import force_text from django.utils.http import urlquote from django.utils import six @@ -108,12 +106,6 @@ class CommonMiddleware(object): """ Calculate the ETag, if needed. """ - if settings.SEND_BROKEN_LINK_EMAILS: - warnings.warn("SEND_BROKEN_LINK_EMAILS is deprecated. " - "Use BrokenLinkEmailsMiddleware instead.", - RemovedInDjango18Warning, stacklevel=2) - BrokenLinkEmailsMiddleware().process_response(request, response) - if settings.USE_ETAGS: if response.has_header('ETag'): etag = response['ETag'] diff --git a/docs/ref/settings.txt b/docs/ref/settings.txt index 8f9e7ba0537..dc1ecc85bb2 100644 --- a/docs/ref/settings.txt +++ b/docs/ref/settings.txt @@ -1917,24 +1917,6 @@ available in ``request.META``.) If any of those are not true, you should keep this setting set to ``None`` and find another way of determining HTTPS, perhaps via custom middleware. -.. setting:: SEND_BROKEN_LINK_EMAILS - -SEND_BROKEN_LINK_EMAILS ------------------------ - -.. deprecated:: 1.6 - Since :class:`~django.middleware.common.BrokenLinkEmailsMiddleware` - was split from :class:`~django.middleware.common.CommonMiddleware`, - this setting no longer serves a purpose. - -Default: ``False`` - -Whether to send an email to the :setting:`MANAGERS` each time somebody visits -a Django-powered page that is 404ed with a non-empty referer (i.e., a broken -link). This is only used if ``CommonMiddleware`` is installed (see -:doc:`/topics/http/middleware`). See also :setting:`IGNORABLE_404_URLS` and -:doc:`/howto/error-reporting`. - .. setting:: SERIALIZATION_MODULES SERIALIZATION_MODULES @@ -2934,7 +2916,6 @@ Email * :setting:`EMAIL_SUBJECT_PREFIX` * :setting:`EMAIL_USE_TLS` * :setting:`MANAGERS` -* :setting:`SEND_BROKEN_LINK_EMAILS` * :setting:`SERVER_EMAIL` Error reporting @@ -2942,7 +2923,6 @@ Error reporting * :setting:`DEFAULT_EXCEPTION_REPORTER_FILTER` * :setting:`IGNORABLE_404_URLS` * :setting:`MANAGERS` -* :setting:`SEND_BROKEN_LINK_EMAILS` * :setting:`SILENCED_SYSTEM_CHECKS` File uploads diff --git a/tests/middleware/tests.py b/tests/middleware/tests.py index 9cda309bfb5..ffe71d1e4db 100644 --- a/tests/middleware/tests.py +++ b/tests/middleware/tests.py @@ -6,7 +6,6 @@ from io import BytesIO import random import re from unittest import skipIf -import warnings from django.conf import settings from django.core import mail @@ -21,7 +20,6 @@ from django.middleware.transaction import TransactionMiddleware from django.test import TransactionTestCase, TestCase, RequestFactory, override_settings from django.test.utils import IgnoreDeprecationWarningsMixin from django.utils import six -from django.utils.deprecation import RemovedInDjango18Warning from django.utils.encoding import force_str from django.utils.six.moves import xrange @@ -241,44 +239,6 @@ class CommonMiddlewareTest(TestCase): self.assertEqual(r.url, 'http://www.testserver/customurlconf/slash/') - # Legacy tests for the 404 error reporting via email (to be removed in 1.8) - - @override_settings(IGNORABLE_404_URLS=(re.compile(r'foo'),), - SEND_BROKEN_LINK_EMAILS=True, - MANAGERS=('PHB@dilbert.com',)) - def test_404_error_reporting(self): - request = self._get_request('regular_url/that/does/not/exist') - request.META['HTTP_REFERER'] = '/another/url/' - with warnings.catch_warnings(): - warnings.simplefilter("ignore", RemovedInDjango18Warning) - response = self.client.get(request.path) - CommonMiddleware().process_response(request, response) - self.assertEqual(len(mail.outbox), 1) - self.assertIn('Broken', mail.outbox[0].subject) - - @override_settings(IGNORABLE_404_URLS=(re.compile(r'foo'),), - SEND_BROKEN_LINK_EMAILS=True, - MANAGERS=('PHB@dilbert.com',)) - def test_404_error_reporting_no_referer(self): - request = self._get_request('regular_url/that/does/not/exist') - with warnings.catch_warnings(): - warnings.simplefilter("ignore", RemovedInDjango18Warning) - response = self.client.get(request.path) - CommonMiddleware().process_response(request, response) - self.assertEqual(len(mail.outbox), 0) - - @override_settings(IGNORABLE_404_URLS=(re.compile(r'foo'),), - SEND_BROKEN_LINK_EMAILS=True, - MANAGERS=('PHB@dilbert.com',)) - def test_404_error_reporting_ignored_url(self): - request = self._get_request('foo_url/that/does/not/exist/either') - request.META['HTTP_REFERER'] = '/another/url/' - with warnings.catch_warnings(): - warnings.simplefilter("ignore", RemovedInDjango18Warning) - response = self.client.get(request.path) - CommonMiddleware().process_response(request, response) - self.assertEqual(len(mail.outbox), 0) - # Other tests def test_non_ascii_query_string_does_not_crash(self):