diff options
| author | Barry Warsaw | 2012-08-18 19:32:53 -0400 |
|---|---|---|
| committer | Barry Warsaw | 2012-08-18 19:32:53 -0400 |
| commit | b301eeb71249ef58ffcc8b285d51b19c8b42812b (patch) | |
| tree | 56552098758969669957f6ba0a175bc2cdbea19d /src | |
| parent | ffd6b7b2ec632920cbf9d413aa20d83d8333c87f (diff) | |
| download | mailman-b301eeb71249ef58ffcc8b285d51b19c8b42812b.tar.gz mailman-b301eeb71249ef58ffcc8b285d51b19c8b42812b.tar.zst mailman-b301eeb71249ef58ffcc8b285d51b19c8b42812b.zip | |
Diffstat (limited to 'src')
| -rw-r--r-- | src/mailman/archiving/docs/common.rst | 6 | ||||
| -rw-r--r-- | src/mailman/archiving/mailarchive.py | 14 | ||||
| -rw-r--r-- | src/mailman/docs/NEWS.rst | 2 | ||||
| -rw-r--r-- | src/mailman/handlers/docs/archives.rst | 7 | ||||
| -rw-r--r-- | src/mailman/handlers/docs/rfc-2369.rst | 7 | ||||
| -rw-r--r-- | src/mailman/handlers/rfc_2369.py | 3 | ||||
| -rw-r--r-- | src/mailman/handlers/to_archive.py | 4 | ||||
| -rw-r--r-- | src/mailman/styles/default.py | 4 |
8 files changed, 28 insertions, 19 deletions
diff --git a/src/mailman/archiving/docs/common.rst b/src/mailman/archiving/docs/common.rst index 7437f4790..86488b26e 100644 --- a/src/mailman/archiving/docs/common.rst +++ b/src/mailman/archiving/docs/common.rst @@ -72,6 +72,8 @@ To archive the message, the archiver actually mails the message to a special address at The Mail Archive. The message gets no header or footer decoration. :: + >>> from mailman.interfaces.archiver import ArchivePolicy + >>> mlist.archive_policy = ArchivePolicy.public >>> archiver.archive_message(mlist, msg) >>> from mailman.runners.outgoing import OutgoingRunner @@ -101,7 +103,7 @@ address at The Mail Archive. The message gets no header or footer decoration. However, if the mailing list is not public, the message will never be archived at this service. - >>> mlist.archive_private = True + >>> mlist.archive_policy = ArchivePolicy.private >>> print archiver.list_url(mlist) None >>> print archiver.permalink(mlist, msg) @@ -114,7 +116,7 @@ Additionally, this archiver can handle malformed ``Message-IDs``. :: >>> from mailman.utilities.email import add_message_hash - >>> mlist.archive_private = False + >>> mlist.archive_policy = ArchivePolicy.public >>> del msg['message-id'] >>> del msg['x-message-id-hash'] >>> msg['Message-ID'] = '12345>' diff --git a/src/mailman/archiving/mailarchive.py b/src/mailman/archiving/mailarchive.py index 69ca77e52..e61683a09 100644 --- a/src/mailman/archiving/mailarchive.py +++ b/src/mailman/archiving/mailarchive.py @@ -30,7 +30,7 @@ from urlparse import urljoin from zope.interface import implementer from mailman.config import config -from mailman.interfaces.archiver import IArchiver +from mailman.interfaces.archiver import ArchivePolicy, IArchiver @@ -46,15 +46,15 @@ class MailArchive: @staticmethod def list_url(mlist): """See `IArchiver`.""" - if mlist.archive_private: - return None - return urljoin(config.archiver.mail_archive.base_url, - quote(mlist.posting_address)) + if mlist.archive_policy is ArchivePolicy.public: + return urljoin(config.archiver.mail_archive.base_url, + quote(mlist.posting_address)) + return None @staticmethod def permalink(mlist, msg): """See `IArchiver`.""" - if mlist.archive_private: + if mlist.archive_policy is not ArchivePolicy.public: return None # It is the LMTP server's responsibility to ensure that the message # has a X-Message-ID-Hash header. If it doesn't then there's no @@ -67,7 +67,7 @@ class MailArchive: @staticmethod def archive_message(mlist, msg): """See `IArchiver`.""" - if not mlist.archive_private: + if mlist.archive_policy is ArchivePolicy.public: config.switchboards['out'].enqueue( msg, listname=mlist.fqdn_listname, diff --git a/src/mailman/docs/NEWS.rst b/src/mailman/docs/NEWS.rst index eb81ac54c..6b376006d 100644 --- a/src/mailman/docs/NEWS.rst +++ b/src/mailman/docs/NEWS.rst @@ -103,6 +103,8 @@ Bug fixes * List-Post should be NO when posting is not allowed. (LP: #987563) * Non-unicode values in msgdata broke pending requests. (LP: #1031391) * Show devmode in `bin/mailman info` output. (LP: #1035028) + * Fix residual references to the old `IMailingList` archive variables. + (LP: #1031393) .. _`passlib`: http://packages.python.org/passlib/index.html diff --git a/src/mailman/handlers/docs/archives.rst b/src/mailman/handlers/docs/archives.rst index 323d121e8..abaad9f52 100644 --- a/src/mailman/handlers/docs/archives.rst +++ b/src/mailman/handlers/docs/archives.rst @@ -26,7 +26,8 @@ should *not* get archived. For example, no digests should ever get archived. - >>> mlist.archive = True + >>> from mailman.interfaces.archiver import ArchivePolicy + >>> mlist.archive_policy = ArchivePolicy.public >>> msg = message_from_string("""\ ... Subject: A sample message ... @@ -39,7 +40,7 @@ For example, no digests should ever get archived. If the mailing list is not configured to archive, then even regular deliveries won't be archived. - >>> mlist.archive = False + >>> mlist.archive_policy = ArchivePolicy.never >>> handler.process(mlist, msg, {}) >>> switchboard.files [] @@ -49,7 +50,7 @@ want to be archived. We've seen both in the wild so both are supported. The ``X-No-Archive:`` header can be used to indicate that the message should not be archived. Confusingly, this header's value is actually ignored. - >>> mlist.archive = True + >>> mlist.archive_policy = ArchivePolicy.public >>> msg = message_from_string("""\ ... Subject: A sample message ... X-No-Archive: YES diff --git a/src/mailman/handlers/docs/rfc-2369.rst b/src/mailman/handlers/docs/rfc-2369.rst index 7eda388c1..7064de6bd 100644 --- a/src/mailman/handlers/docs/rfc-2369.rst +++ b/src/mailman/handlers/docs/rfc-2369.rst @@ -7,7 +7,8 @@ headers generally start with the `List-` prefix. >>> mlist = create_list('test@example.com') >>> mlist.preferred_language = 'en' - >>> mlist.archive = False + >>> from mailman.interfaces.archiver import ArchivePolicy + >>> mlist.archive_policy = ArchivePolicy.never .. This is a helper function for the following section. @@ -171,7 +172,7 @@ Archive headers When the mailing list is configured to enable archiving, a `List-Archive` header will be added. - >>> mlist.archive = True + >>> mlist.archive_policy = ArchivePolicy.public `RFC 5064`_ defines the `Archived-At` header which contains the url to the individual message in the archives. Archivers which don't support @@ -208,7 +209,7 @@ If the mailing list isn't being archived, neither the `List-Archive` nor `Archived-At` headers will be added. >>> config.pop('prototype') - >>> mlist.archive = False + >>> mlist.archive_policy = ArchivePolicy.never >>> msg = message_from_string("""\ ... From: aperson@example.com ... diff --git a/src/mailman/handlers/rfc_2369.py b/src/mailman/handlers/rfc_2369.py index 43eb30acd..ee2bdb503 100644 --- a/src/mailman/handlers/rfc_2369.py +++ b/src/mailman/handlers/rfc_2369.py @@ -31,6 +31,7 @@ from zope.interface import implementer from mailman.config import config from mailman.core.i18n import _ from mailman.handlers.cook_headers import uheader +from mailman.interfaces.archiver import ArchivePolicy from mailman.interfaces.handler import IHandler @@ -82,7 +83,7 @@ def process(mlist, msg, msgdata): else 'NO') headers['List-Post'] = list_post # Add RFC 2369 and 5064 archiving headers, if archiving is enabled. - if mlist.archive: + if mlist.archive_policy != ArchivePolicy.never: for archiver in config.archivers: headers['List-Archive'] = '<{0}>'.format( archiver.list_url(mlist)) diff --git a/src/mailman/handlers/to_archive.py b/src/mailman/handlers/to_archive.py index 0dc5bad1a..5718557fa 100644 --- a/src/mailman/handlers/to_archive.py +++ b/src/mailman/handlers/to_archive.py @@ -29,6 +29,7 @@ from zope.interface import implementer from mailman.config import config from mailman.core.i18n import _ +from mailman.interfaces.archiver import ArchivePolicy from mailman.interfaces.handler import IHandler @@ -43,7 +44,8 @@ class ToArchive: def process(self, mlist, msg, msgdata): """See `IHandler`.""" # Short circuits. - if msgdata.get('isdigest') or not mlist.archive: + if (msgdata.get('isdigest') or + mlist.archive_policy == ArchivePolicy.never): 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 diff --git a/src/mailman/styles/default.py b/src/mailman/styles/default.py index 21da19aa5..e16b97547 100644 --- a/src/mailman/styles/default.py +++ b/src/mailman/styles/default.py @@ -32,6 +32,7 @@ from zope.interface import implementer from mailman.core.i18n import _ from mailman.interfaces.action import Action, FilterAction +from mailman.interfaces.archiver import ArchivePolicy from mailman.interfaces.bounce import UnrecognizedBounceDisposition from mailman.interfaces.digests import DigestFrequency from mailman.interfaces.autorespond import ResponseAction @@ -116,8 +117,7 @@ from: .*@uplinkpro.com mlist.default_member_action = Action.defer mlist.default_nonmember_action = Action.hold # Archiver - mlist.archive = True - mlist.archive_private = False + mlist.archive_policy = ArchivePolicy.public mlist.archive_volume_frequency = 1 mlist.emergency = False mlist.member_moderation_notice = '' |
