Removed settings.SEND_BROKEN_LINK_EMAILS per deprecation timeline.
This commit is contained in:
parent
aa93a1890f
commit
11e22129d5
|
@ -168,9 +168,6 @@ FILE_CHARSET = 'utf-8'
|
||||||
# Email address that error messages come from.
|
# Email address that error messages come from.
|
||||||
SERVER_EMAIL = 'root@localhost'
|
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.
|
# Database connection info. If left empty, will default to the dummy backend.
|
||||||
DATABASES = {}
|
DATABASES = {}
|
||||||
|
|
||||||
|
|
|
@ -1,13 +1,11 @@
|
||||||
import hashlib
|
import hashlib
|
||||||
import logging
|
import logging
|
||||||
import re
|
import re
|
||||||
import warnings
|
|
||||||
|
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from django.core.mail import mail_managers
|
from django.core.mail import mail_managers
|
||||||
from django.core import urlresolvers
|
from django.core import urlresolvers
|
||||||
from django import http
|
from django import http
|
||||||
from django.utils.deprecation import RemovedInDjango18Warning
|
|
||||||
from django.utils.encoding import force_text
|
from django.utils.encoding import force_text
|
||||||
from django.utils.http import urlquote
|
from django.utils.http import urlquote
|
||||||
from django.utils import six
|
from django.utils import six
|
||||||
|
@ -108,12 +106,6 @@ class CommonMiddleware(object):
|
||||||
"""
|
"""
|
||||||
Calculate the ETag, if needed.
|
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 settings.USE_ETAGS:
|
||||||
if response.has_header('ETag'):
|
if response.has_header('ETag'):
|
||||||
etag = response['ETag']
|
etag = response['ETag']
|
||||||
|
|
|
@ -1917,24 +1917,6 @@ available in ``request.META``.)
|
||||||
If any of those are not true, you should keep this setting set to ``None``
|
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.
|
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
|
.. setting:: SERIALIZATION_MODULES
|
||||||
|
|
||||||
SERIALIZATION_MODULES
|
SERIALIZATION_MODULES
|
||||||
|
@ -2934,7 +2916,6 @@ Email
|
||||||
* :setting:`EMAIL_SUBJECT_PREFIX`
|
* :setting:`EMAIL_SUBJECT_PREFIX`
|
||||||
* :setting:`EMAIL_USE_TLS`
|
* :setting:`EMAIL_USE_TLS`
|
||||||
* :setting:`MANAGERS`
|
* :setting:`MANAGERS`
|
||||||
* :setting:`SEND_BROKEN_LINK_EMAILS`
|
|
||||||
* :setting:`SERVER_EMAIL`
|
* :setting:`SERVER_EMAIL`
|
||||||
|
|
||||||
Error reporting
|
Error reporting
|
||||||
|
@ -2942,7 +2923,6 @@ Error reporting
|
||||||
* :setting:`DEFAULT_EXCEPTION_REPORTER_FILTER`
|
* :setting:`DEFAULT_EXCEPTION_REPORTER_FILTER`
|
||||||
* :setting:`IGNORABLE_404_URLS`
|
* :setting:`IGNORABLE_404_URLS`
|
||||||
* :setting:`MANAGERS`
|
* :setting:`MANAGERS`
|
||||||
* :setting:`SEND_BROKEN_LINK_EMAILS`
|
|
||||||
* :setting:`SILENCED_SYSTEM_CHECKS`
|
* :setting:`SILENCED_SYSTEM_CHECKS`
|
||||||
|
|
||||||
File uploads
|
File uploads
|
||||||
|
|
|
@ -6,7 +6,6 @@ from io import BytesIO
|
||||||
import random
|
import random
|
||||||
import re
|
import re
|
||||||
from unittest import skipIf
|
from unittest import skipIf
|
||||||
import warnings
|
|
||||||
|
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from django.core import mail
|
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 import TransactionTestCase, TestCase, RequestFactory, override_settings
|
||||||
from django.test.utils import IgnoreDeprecationWarningsMixin
|
from django.test.utils import IgnoreDeprecationWarningsMixin
|
||||||
from django.utils import six
|
from django.utils import six
|
||||||
from django.utils.deprecation import RemovedInDjango18Warning
|
|
||||||
from django.utils.encoding import force_str
|
from django.utils.encoding import force_str
|
||||||
from django.utils.six.moves import xrange
|
from django.utils.six.moves import xrange
|
||||||
|
|
||||||
|
@ -241,44 +239,6 @@ class CommonMiddlewareTest(TestCase):
|
||||||
self.assertEqual(r.url,
|
self.assertEqual(r.url,
|
||||||
'http://www.testserver/customurlconf/slash/')
|
'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
|
# Other tests
|
||||||
|
|
||||||
def test_non_ascii_query_string_does_not_crash(self):
|
def test_non_ascii_query_string_does_not_crash(self):
|
||||||
|
|
Loading…
Reference in New Issue