diff options
| author | Barry Warsaw | 2008-03-30 00:06:07 -0400 |
|---|---|---|
| committer | Barry Warsaw | 2008-03-30 00:06:07 -0400 |
| commit | 7f440dc39489b32257c35f15ee6f27d90a197cf5 (patch) | |
| tree | a4aaec013ee63253b78cfeb3518e78b1df424a91 /mailman/queue | |
| parent | eecf4b29f2642f30b22ee978fa50d8713bec1a48 (diff) | |
| download | mailman-7f440dc39489b32257c35f15ee6f27d90a197cf5.tar.gz mailman-7f440dc39489b32257c35f15ee6f27d90a197cf5.tar.zst mailman-7f440dc39489b32257c35f15ee6f27d90a197cf5.zip | |
Diffstat (limited to 'mailman/queue')
| -rw-r--r-- | mailman/queue/archive.py | 12 | ||||
| -rw-r--r-- | mailman/queue/docs/archiver.txt | 35 | ||||
| -rw-r--r-- | mailman/queue/outgoing.py | 6 |
3 files changed, 49 insertions, 4 deletions
diff --git a/mailman/queue/archive.py b/mailman/queue/archive.py index 47627a04e..854e4340f 100644 --- a/mailman/queue/archive.py +++ b/mailman/queue/archive.py @@ -19,12 +19,19 @@ from __future__ import with_statement +__metaclass__ = type +__all__ = [ + 'ArchiveRunner', + ] + + import os import time from email.Utils import parsedate_tz, mktime_tz, formatdate from locknix.lockfile import Lock +from mailman.app.plugins import get_plugins from mailman.configuration import config from mailman.queue import Runner @@ -70,4 +77,7 @@ class ArchiveRunner(Runner): msg['X-List-Received-Date'] = receivedtime # While a list archiving lock is acquired, archive the message. with Lock(os.path.join(mlist.data_path, 'archive.lck')): - mlist.ArchiveMail(msg) + for archive_factory in get_plugins('mailman.archiver'): + archiver = archive_factory(mlist) + archiver.archive_message(msg) + diff --git a/mailman/queue/docs/archiver.txt b/mailman/queue/docs/archiver.txt new file mode 100644 index 000000000..43b6d4974 --- /dev/null +++ b/mailman/queue/docs/archiver.txt @@ -0,0 +1,35 @@ +Archiving +========= + +Mailman can archive to any number of archivers that adhere to the IArchiver +interface. By default, there's a Pipermail archiver. + + >>> from mailman.app.lifecycle import create_list + >>> mlist = create_list(u'test@example.com') + >>> mlist.web_page_url = u'http://www.example.com/' + + >>> msg = message_from_string("""\ + ... From: aperson@example.com + ... To: test@example.com + ... Subject: My first post + ... Message-ID: <first> + ... + ... First post! + ... """) + + >>> from mailman.configuration import config + >>> from mailman.queue import Switchboard + >>> archiver_queue = Switchboard(config.ARCHQUEUE_DIR) + >>> ignore = archiver_queue.enqueue(msg, {}, listname=mlist.fqdn_listname) + + >>> from mailman.queue.archive import ArchiveRunner + >>> from mailman.tests.helpers import make_testable_runner + >>> runner = make_testable_runner(ArchiveRunner) + >>> runner.run() + + # The best we can do is verify some landmark exists. Let's use the + # Pipermail pickle file exists. + >>> import os + >>> os.path.exists(os.path.join(config.PUBLIC_ARCHIVE_FILE_DIR, + ... mlist.fqdn_listname, 'pipermail.pck')) + True diff --git a/mailman/queue/outgoing.py b/mailman/queue/outgoing.py index 838d7d137..4c067b8c0 100644 --- a/mailman/queue/outgoing.py +++ b/mailman/queue/outgoing.py @@ -20,10 +20,10 @@ import os import sys import copy -import time import email import socket import logging +import datetime from mailman import Errors from mailman import Message @@ -57,7 +57,7 @@ class OutgoingRunner(Runner, BounceMixin): def _dispose(self, mlist, msg, msgdata): # See if we should retry delivery of this message again. deliver_after = msgdata.get('deliver_after', 0) - if time.time() < deliver_after: + if datetime.datetime.now() < deliver_after: return True # Make sure we have the most up-to-date state try: @@ -102,7 +102,7 @@ class OutgoingRunner(Runner, BounceMixin): # occasionally move them back here for another shot at # delivery. if e.tempfailures: - now = time.time() + now = datetime.datetime.now() recips = e.tempfailures last_recip_count = msgdata.get('last_recip_count', 0) deliver_until = msgdata.get('deliver_until', now) |
