summaryrefslogtreecommitdiff
path: root/src/mailman/chains/hold.py
diff options
context:
space:
mode:
authorBarry Warsaw2016-03-24 10:16:21 -0400
committerBarry Warsaw2016-03-24 10:16:21 -0400
commit8cc7e77b85f013d6f9ea4cda16ae18856fd6ccee (patch)
tree0ae6c01bf71492fe6b8e65e0576132a7a4986a71 /src/mailman/chains/hold.py
parentce9370a537683e6e4e934b8018d0fe3f2aa7f9ac (diff)
downloadmailman-8cc7e77b85f013d6f9ea4cda16ae18856fd6ccee.tar.gz
mailman-8cc7e77b85f013d6f9ea4cda16ae18856fd6ccee.tar.zst
mailman-8cc7e77b85f013d6f9ea4cda16ae18856fd6ccee.zip
Diffstat (limited to 'src/mailman/chains/hold.py')
-rw-r--r--src/mailman/chains/hold.py25
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 = _(