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

Stopped truncating AdminEmailHandler message subjects

Refs #26572, #17281. The RFC doesn't limit total length, just the line length
which is already taken care of by Python itself.
Thanks Tim Graham for the review.
This commit is contained in:
Claude Paroz
2016-05-03 18:22:46 +02:00
parent 31e0314979
commit c3e1086949
3 changed files with 6 additions and 27 deletions

View File

@@ -128,12 +128,9 @@ class AdminEmailHandler(logging.Handler):
def format_subject(self, subject):
"""
Escape CR and LF characters, and limit length.
RFC 2822's hard limit is 998 characters per line. So, minus "Subject: "
the actual subject must be no longer than 989 characters.
Escape CR and LF characters.
"""
formatted_subject = subject.replace('\n', '\\n').replace('\r', '\\r')
return formatted_subject[:989]
return subject.replace('\n', '\\n').replace('\r', '\\r')
class CallbackFilter(logging.Filter):