summaryrefslogtreecommitdiff
path: root/Mailman/pipeline/to_archive.py
diff options
context:
space:
mode:
authorBarry Warsaw2008-02-17 17:34:21 -0500
committerBarry Warsaw2008-02-17 17:34:21 -0500
commit69d158b13ae9cfa37040c2e7a664ca266b42050b (patch)
tree07f48ee990b6bab514f86199eaa250a04280120c /Mailman/pipeline/to_archive.py
parentb36de8a6a5b84021c003b728274f7e9e95861c9d (diff)
downloadmailman-69d158b13ae9cfa37040c2e7a664ca266b42050b.tar.gz
mailman-69d158b13ae9cfa37040c2e7a664ca266b42050b.tar.zst
mailman-69d158b13ae9cfa37040c2e7a664ca266b42050b.zip
Diffstat (limited to 'Mailman/pipeline/to_archive.py')
-rw-r--r--Mailman/pipeline/to_archive.py43
1 files changed, 30 insertions, 13 deletions
diff --git a/Mailman/pipeline/to_archive.py b/Mailman/pipeline/to_archive.py
index e67513c84..f85488ded 100644
--- a/Mailman/pipeline/to_archive.py
+++ b/Mailman/pipeline/to_archive.py
@@ -17,21 +17,38 @@
"""Add the message to the archives."""
+__metaclass__ = type
+__all__ = ['ToArchive']
+
+
+from zope.interface import implements
+
from Mailman.configuration import config
+from Mailman.i18n import _
+from Mailman.interfaces import IHandler
from Mailman.queue import Switchboard
-def process(mlist, msg, msgdata):
- # short circuits
- if msgdata.get('isdigest') or not mlist.archive:
- return
- # Common practice seems to favor "X-No-Archive: yes". No other value for
- # this header seems to make sense, so we'll just test for it's presence.
- # I'm keeping "X-Archive: no" for backwards compatibility.
- if 'x-no-archive' in msg or msg.get('x-archive', '').lower() == 'no':
- return
- # Send the message to the archiver queue
- archq = Switchboard(config.ARCHQUEUE_DIR)
- # Send the message to the queue
- archq.enqueue(msg, msgdata)
+class ToArchive:
+ """Add the message to the archives."""
+
+ implements(IHandler)
+
+ name = 'to-archive'
+ description = _('Add the message to the archives.')
+
+ def process(self, mlist, msg, msgdata):
+ """See `IHandler`."""
+ # Short circuits.
+ if msgdata.get('isdigest') or not mlist.archive:
+ return
+ # Common practice seems to favor "X-No-Archive: yes". No other value
+ # for this header seems to make sense, so we'll just test for it's
+ # presence. I'm keeping "X-Archive: no" for backwards compatibility.
+ if 'x-no-archive' in msg or msg.get('x-archive', '').lower() == 'no':
+ return
+ # Send the message to the archiver queue
+ archq = Switchboard(config.ARCHQUEUE_DIR)
+ # Send the message to the queue
+ archq.enqueue(msg, msgdata)