summaryrefslogtreecommitdiff
path: root/src/mailman/app/moderator.py
diff options
context:
space:
mode:
authorBarry Warsaw2016-03-23 23:40:54 -0400
committerBarry Warsaw2016-03-23 23:40:54 -0400
commitf51c63ca108134dd30f26641bef15bfcddd6e502 (patch)
treeb3cc41a2d54d11f62886db7ceab3985b9bee18f1 /src/mailman/app/moderator.py
parentab2b619db5f3de47cffc2740901c4f82958a7d96 (diff)
downloadmailman-f51c63ca108134dd30f26641bef15bfcddd6e502.tar.gz
mailman-f51c63ca108134dd30f26641bef15bfcddd6e502.tar.zst
mailman-f51c63ca108134dd30f26641bef15bfcddd6e502.zip
First massive round of cleanups.
* Get rid of explicit __all__ settings and use the @public decorator. * Get rid of ^L's * Use expected_count argument for get_queue_messages() * Various code modernizations. * Other minor changes to make flake8 happy.
Diffstat (limited to 'src/mailman/app/moderator.py')
-rw-r--r--src/mailman/app/moderator.py25
1 files changed, 8 insertions, 17 deletions
diff --git a/src/mailman/app/moderator.py b/src/mailman/app/moderator.py
index af2addea7..335c7a409 100644
--- a/src/mailman/app/moderator.py
+++ b/src/mailman/app/moderator.py
@@ -17,20 +17,11 @@
"""Application support for moderators."""
-__all__ = [
- 'handle_ListDeletingEvent',
- 'handle_message',
- 'handle_unsubscription',
- 'hold_message',
- 'hold_unsubscription',
- 'send_rejection',
- ]
-
-
import time
import logging
from email.utils import formatdate, getaddresses, make_msgid
+from mailman import public
from mailman.app.membership import delete_member
from mailman.config import config
from mailman.core.i18n import _
@@ -51,7 +42,7 @@ vlog = logging.getLogger('mailman.vette')
slog = logging.getLogger('mailman.subscribe')
-
+@public
def hold_message(mlist, msg, msgdata=None, reason=None):
"""Hold a message for moderator approval.
@@ -97,7 +88,7 @@ def hold_message(mlist, msg, msgdata=None, reason=None):
return request_id
-
+@public
def handle_message(mlist, id, action, comment=None, forward=None):
message_store = getUtility(IMessageStore)
requestdb = IListRequests(mlist)
@@ -187,7 +178,7 @@ def handle_message(mlist, id, action, comment=None, forward=None):
vlog.info(note, mlist.fqdn_listname, rejection, sender, subject)
-
+@public
def hold_unsubscription(mlist, email):
data = dict(email=email)
requestsdb = IListRequests(mlist)
@@ -214,7 +205,7 @@ def hold_unsubscription(mlist, email):
return request_id
-
+@public
def handle_unsubscription(mlist, id, action, comment=None):
requestdb = IListRequests(mlist)
key, data = requestdb.get_request(id)
@@ -244,12 +235,12 @@ def handle_unsubscription(mlist, id, action, comment=None):
requestdb.delete_request(id)
-
+@public
def send_rejection(mlist, request, recip, comment, origmsg=None, lang=None):
# As this message is going to the requester, try to set the language to
# his/her language choice, if they are a member. Otherwise use the list's
# preferred language.
- display_name = mlist.display_name
+ display_name = mlist.display_name # flake8: noqa
if lang is None:
member = mlist.members.get_member(recip)
lang = (mlist.preferred_language
@@ -276,7 +267,7 @@ def send_rejection(mlist, request, recip, comment, origmsg=None, lang=None):
msg.send(mlist)
-
+@public
def handle_ListDeletingEvent(event):
if not isinstance(event, ListDeletingEvent):
return