mirror of
https://github.com/django/django.git
synced 2025-06-05 11:39:13 +00:00
Fixed #19637 -- Ensured AdminEmailHandler fails silently
Thanks lsaffre for the report. Refs #19325.
This commit is contained in:
parent
7aa538357c
commit
c6e0dedbdb
@ -117,7 +117,7 @@ class AdminEmailHandler(logging.Handler):
|
|||||||
connection=self.connection())
|
connection=self.connection())
|
||||||
|
|
||||||
def connection(self):
|
def connection(self):
|
||||||
return get_connection(backend=self.email_backend)
|
return get_connection(backend=self.email_backend, fail_silently=True)
|
||||||
|
|
||||||
def format_subject(self, subject):
|
def format_subject(self, subject):
|
||||||
"""
|
"""
|
||||||
|
@ -154,6 +154,10 @@ class AdminEmailHandlerTest(TestCase):
|
|||||||
][0]
|
][0]
|
||||||
return admin_email_handler
|
return admin_email_handler
|
||||||
|
|
||||||
|
def test_fail_silently(self):
|
||||||
|
admin_email_handler = self.get_admin_email_handler(self.logger)
|
||||||
|
self.assertTrue(admin_email_handler.connection().fail_silently)
|
||||||
|
|
||||||
@override_settings(
|
@override_settings(
|
||||||
ADMINS=(('whatever admin', 'admin@example.com'),),
|
ADMINS=(('whatever admin', 'admin@example.com'),),
|
||||||
EMAIL_SUBJECT_PREFIX='-SuperAwesomeSubject-'
|
EMAIL_SUBJECT_PREFIX='-SuperAwesomeSubject-'
|
||||||
|
Loading…
x
Reference in New Issue
Block a user