diff options
Diffstat (limited to 'src/mailman/chains/hold.py')
| -rw-r--r-- | src/mailman/chains/hold.py | 25 |
1 files changed, 9 insertions, 16 deletions
diff --git a/src/mailman/chains/hold.py b/src/mailman/chains/hold.py index d83d3571b..329bbc71b 100644 --- a/src/mailman/chains/hold.py +++ b/src/mailman/chains/hold.py @@ -17,16 +17,12 @@ """The terminal 'hold' chain.""" -__all__ = [ - 'HoldChain', - ] - - import logging from email.mime.message import MIMEMessage from email.mime.text import MIMEText from email.utils import formatdate, make_msgid +from mailman import public from mailman.app.moderator import hold_message from mailman.app.replybot import can_acknowledge from mailman.chains.base import TerminalChainBase @@ -52,13 +48,11 @@ NL = '\n' log = logging.getLogger('mailman.vette') - @implementer(IPendable) class HeldMessagePendable(dict): PEND_TYPE = 'held message' - def _compose_reasons(msgdata, column=66): # Rules can add reasons to the metadata. reasons = msgdata.get('moderation_reasons', [_('N/A')]) @@ -67,7 +61,6 @@ def _compose_reasons(msgdata, column=66): for reason in reasons]) - def autorespond_to_sender(mlist, sender, language=None): """Should Mailman automatically respond to this sender? @@ -127,7 +120,7 @@ def autorespond_to_sender(mlist, sender, language=None): return False - +@public class HoldChain(TerminalChainBase): """Hold a message.""" @@ -170,10 +163,10 @@ class HoldChain(TerminalChainBase): bytes_subject = oneline_subject.encode(charset, 'replace') original_subject = bytes_subject.decode(charset) substitutions = dict( - listname = mlist.fqdn_listname, - subject = original_subject, - sender = msg.sender, - reasons = _compose_reasons(msgdata), + listname = mlist.fqdn_listname, # flake8: noqa + subject = original_subject, # flake8: noqa + sender = msg.sender, # flake8: noqa + reasons = _compose_reasons(msgdata), # flake8: noqa ) # At this point the message is held, but now we have to craft at least # two responses. The first will go to the original author of the @@ -190,9 +183,9 @@ class HoldChain(TerminalChainBase): # mailing list, or the author (if they are a member) have been # configured to not send such responses. if (not msgdata.get('fromusenet') and - can_acknowledge(msg) and - mlist.respond_to_post_requests and - autorespond_to_sender(mlist, msg.sender, language)): + can_acknowledge(msg) and + mlist.respond_to_post_requests and + autorespond_to_sender(mlist, msg.sender, language)): # We can respond to the sender with a message indicating their # posting was held. subject = _( |
