From c6e0dedbdb22f4db6577886a2b67e5423684fe7f Mon Sep 17 00:00:00 2001 From: Claude Paroz Date: Mon, 21 Jan 2013 20:27:38 +0100 Subject: [PATCH] Fixed #19637 -- Ensured AdminEmailHandler fails silently Thanks lsaffre for the report. Refs #19325. --- django/utils/log.py | 2 +- tests/regressiontests/logging_tests/tests.py | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/django/utils/log.py b/django/utils/log.py index 292bd0794c..b291b86706 100644 --- a/django/utils/log.py +++ b/django/utils/log.py @@ -117,7 +117,7 @@ class AdminEmailHandler(logging.Handler): connection=self.connection()) 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): """ diff --git a/tests/regressiontests/logging_tests/tests.py b/tests/regressiontests/logging_tests/tests.py index b3d9f3b352..b7d06bf362 100644 --- a/tests/regressiontests/logging_tests/tests.py +++ b/tests/regressiontests/logging_tests/tests.py @@ -154,6 +154,10 @@ class AdminEmailHandlerTest(TestCase): ][0] 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( ADMINS=(('whatever admin', 'admin@example.com'),), EMAIL_SUBJECT_PREFIX='-SuperAwesomeSubject-'