diff options
| author | Barry Warsaw | 2016-03-25 09:36:52 -0400 |
|---|---|---|
| committer | Barry Warsaw | 2016-03-25 09:36:52 -0400 |
| commit | b9c06627e46ff1e9f09965228ab3b48f217109af (patch) | |
| tree | a600fa04dd2ac6d006b88aee2c5e605673629fa3 /src/mailman/handlers/cook_headers.py | |
| parent | 49d630f2761175e404f3b1d811e61bc43eb6b25b (diff) | |
| download | mailman-b9c06627e46ff1e9f09965228ab3b48f217109af.tar.gz mailman-b9c06627e46ff1e9f09965228ab3b48f217109af.tar.zst mailman-b9c06627e46ff1e9f09965228ab3b48f217109af.zip | |
Diffstat (limited to 'src/mailman/handlers/cook_headers.py')
| -rw-r--r-- | src/mailman/handlers/cook_headers.py | 18 |
1 files changed, 7 insertions, 11 deletions
diff --git a/src/mailman/handlers/cook_headers.py b/src/mailman/handlers/cook_headers.py index e49c2fa52..ed4c28c8c 100644 --- a/src/mailman/handlers/cook_headers.py +++ b/src/mailman/handlers/cook_headers.py @@ -17,15 +17,11 @@ """Cook a message's headers.""" -__all__ = [ - 'CookHeaders', - ] - - import re from email.header import Header from email.utils import parseaddr, formataddr, getaddresses +from mailman import public from mailman.core.i18n import _ from mailman.interfaces.handler import IHandler from mailman.interfaces.mailinglist import Personalization, ReplyToMunging @@ -38,7 +34,7 @@ MAXLINELEN = 78 NONASCII = re.compile('[^\s!-~]') - +@public def uheader(mlist, s, header_name=None, continuation_ws='\t', maxlinelen=None): """Get the charset to encode the string in. @@ -58,7 +54,6 @@ def uheader(mlist, s, header_name=None, continuation_ws='\t', maxlinelen=None): return Header(s, charset, maxlinelen, header_name, continuation_ws) - def process(mlist, msg, msgdata): """Process the headers of the message.""" # Set the "X-Ack: no" header if noack flag is set. @@ -103,7 +98,7 @@ def process(mlist, msg, msgdata): # A convenience function, requires nested scopes. pair is (name, addr) new = [] d = {} - def add(pair): + def add(pair): # flake8: noqa lcaddr = pair[1].lower() if lcaddr in d: return @@ -143,8 +138,9 @@ def process(mlist, msg, msgdata): # Also skip Cc if this is an anonymous list as list posting address # is already in From and Reply-To in this case. if (mlist.personalize is Personalization.full and - mlist.reply_goes_to_list is not ReplyToMunging.point_to_list and - not mlist.anonymous_list): + mlist.reply_goes_to_list is not + ReplyToMunging.point_to_list and + not mlist.anonymous_list): # Watch out for existing Cc headers, merge, and remove dups. Note # that RFC 2822 says only zero or one Cc header is allowed. new = [] @@ -157,7 +153,7 @@ def process(mlist, msg, msgdata): msg['Cc'] = COMMASPACE.join([formataddr(pair) for pair in new]) - +@public @implementer(IHandler) class CookHeaders: """Modify message headers.""" |
