1
0
mirror of https://github.com/django/django.git synced 2025-10-24 06:06:09 +00:00

Fixed #35364 -- Stopped AdminEmailHandler rendering email unnecessarily.

This commit is contained in:
Adam Johnson
2024-04-09 16:01:37 +01:00
committed by Sarah Boyce
parent b0f2289426
commit 50a702f3fd
3 changed files with 15 additions and 2 deletions

View File

@@ -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" % (