diff options
| author | Barry Warsaw | 2008-06-15 00:01:55 -0400 |
|---|---|---|
| committer | Barry Warsaw | 2008-06-15 00:01:55 -0400 |
| commit | ee349897c99a75da4da4698c64bee8cd0d743d97 (patch) | |
| tree | e2b00e3c9eb399d8dd77d6a60a30a996af57ed44 /mailman/app/archiving.py | |
| parent | 67e437883d520bf7ea78ae55235892aa946ef0b4 (diff) | |
| parent | 3d192123461559445bd7e68ef163828bb51852e6 (diff) | |
| download | mailman-ee349897c99a75da4da4698c64bee8cd0d743d97.tar.gz mailman-ee349897c99a75da4da4698c64bee8cd0d743d97.tar.zst mailman-ee349897c99a75da4da4698c64bee8cd0d743d97.zip | |
Rework the archiver interface. Remove get_primary_archiver() since now there
can be any number of them.
get_list_url() -> list_url()
get_message_url() -> permalink()
Only add Archived-At header if mlist.archive is set.
Diffstat (limited to 'mailman/app/archiving.py')
| -rw-r--r-- | mailman/app/archiving.py | 41 |
1 files changed, 12 insertions, 29 deletions
diff --git a/mailman/app/archiving.py b/mailman/app/archiving.py index c790bc3dc..5a752063d 100644 --- a/mailman/app/archiving.py +++ b/mailman/app/archiving.py @@ -20,18 +20,14 @@ __metaclass__ = type __all__ = [ 'Pipermail', - 'get_primary_archiver', ] import os -import pkg_resources from string import Template from zope.interface import implements -from zope.interface.verify import verifyObject -from mailman.app.plugins import get_plugins from mailman.configuration import config from mailman.interfaces import IArchiver @@ -64,47 +60,34 @@ class Pipermail: implements(IArchiver) - def __init__(self, mlist): - self._mlist = mlist - - def get_list_url(self): + @staticmethod + def list_url(mlist): """See `IArchiver`.""" - if self._mlist.archive_private: - url = self._mlist.script_url('private') + '/index.html' + if mlist.archive_private: + url = mlist.script_url('private') + '/index.html' else: - web_host = config.domains.get( - self._mlist.host_name, self._mlist.host_name) + web_host = config.domains.get(mlist.host_name, mlist.host_name) url = Template(config.PUBLIC_ARCHIVE_URL).safe_substitute( - listname=self._mlist.fqdn_listname, + listname=mlist.fqdn_listname, hostname=web_host, - fqdn_listname=self._mlist.fqdn_listname, + fqdn_listname=mlist.fqdn_listname, ) return url - def get_message_url(self, message): + @staticmethod + def permalink(mlist, message): """See `IArchiver`.""" # Not currently implemented. return None - def archive_message(self, message): + @staticmethod + def archive_message(mlist, message): """See `IArchiver`.""" text = str(message) fileobj = StringIO(text) - h = HyperArchive(PipermailMailingListAdapter(self._mlist)) + h = HyperArchive(PipermailMailingListAdapter(mlist)) h.processUnixMailbox(fileobj) h.close() fileobj.close() # There's no good way to know the url for the archived message. return None - - - -def get_primary_archiver(mlist): - """Return the primary archiver.""" - entry_points = list(pkg_resources.iter_entry_points('mailman.archiver')) - if len(entry_points) == 0: - return None - for ep in entry_points: - if ep.name == 'default': - return ep.load()(mlist) - return None |
