From 50a702f3fd87e271945aa5e88ae8a39d7a2149fd Mon Sep 17 00:00:00 2001 From: Adam Johnson Date: Tue, 9 Apr 2024 16:01:37 +0100 Subject: Fixed #35364 -- Stopped AdminEmailHandler rendering email unnecessarily. --- django/utils/log.py | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'django/utils') diff --git a/django/utils/log.py b/django/utils/log.py index fd0cc1bdc1..a25b97a7d5 100644 --- a/django/utils/log.py +++ b/django/utils/log.py @@ -92,6 +92,13 @@ class AdminEmailHandler(logging.Handler): ) def emit(self, record): + # Early return when no email will be sent. + if ( + not settings.ADMINS + # Method not overridden. + and self.send_mail.__func__ is AdminEmailHandler.send_mail + ): + return try: request = record.request subject = "%s (%s IP): %s" % ( -- cgit v1.3