diff options
| author | Barry Warsaw | 2012-07-06 21:08:41 -0400 |
|---|---|---|
| committer | Barry Warsaw | 2012-07-06 21:08:41 -0400 |
| commit | 8d8ab1655b51e277570005b445d3b014afcfbc57 (patch) | |
| tree | 6ba0147d975636e129a787c9dfa64dae8cffae89 /src/mailman/handlers | |
| parent | cd3f84b301c2150fea5402129a2e7bc862fbb52b (diff) | |
| parent | 01415190ab44e69a8f09a6411564a7cb288404e8 (diff) | |
| download | mailman-8d8ab1655b51e277570005b445d3b014afcfbc57.tar.gz mailman-8d8ab1655b51e277570005b445d3b014afcfbc57.tar.zst mailman-8d8ab1655b51e277570005b445d3b014afcfbc57.zip | |
trunk merge
Diffstat (limited to 'src/mailman/handlers')
| -rw-r--r-- | src/mailman/handlers/acknowledge.py | 6 | ||||
| -rw-r--r-- | src/mailman/handlers/after_delivery.py | 7 | ||||
| -rw-r--r-- | src/mailman/handlers/avoid_duplicates.py | 7 | ||||
| -rw-r--r-- | src/mailman/handlers/cleanse.py | 7 | ||||
| -rw-r--r-- | src/mailman/handlers/cleanse_dkim.py | 7 | ||||
| -rw-r--r-- | src/mailman/handlers/cook_headers.py | 7 | ||||
| -rw-r--r-- | src/mailman/handlers/decorate.py | 7 | ||||
| -rw-r--r-- | src/mailman/handlers/docs/rfc-2369.rst | 27 | ||||
| -rw-r--r-- | src/mailman/handlers/file_recipients.py | 7 | ||||
| -rw-r--r-- | src/mailman/handlers/member_recipients.py | 5 | ||||
| -rw-r--r-- | src/mailman/handlers/mime_delete.py | 7 | ||||
| -rw-r--r-- | src/mailman/handlers/owner_recipients.py | 5 | ||||
| -rw-r--r-- | src/mailman/handlers/replybot.py | 7 | ||||
| -rw-r--r-- | src/mailman/handlers/rfc_2369.py | 17 | ||||
| -rw-r--r-- | src/mailman/handlers/tagger.py | 7 | ||||
| -rw-r--r-- | src/mailman/handlers/to_archive.py | 7 | ||||
| -rw-r--r-- | src/mailman/handlers/to_digest.py | 7 | ||||
| -rw-r--r-- | src/mailman/handlers/to_outgoing.py | 7 | ||||
| -rw-r--r-- | src/mailman/handlers/to_usenet.py | 5 |
19 files changed, 84 insertions, 72 deletions
diff --git a/src/mailman/handlers/acknowledge.py b/src/mailman/handlers/acknowledge.py index 0e0916337..0366f8ce6 100644 --- a/src/mailman/handlers/acknowledge.py +++ b/src/mailman/handlers/acknowledge.py @@ -20,7 +20,7 @@ This only happens if the sender has set their AcknowledgePosts attribute. """ -from __future__ import absolute_import, unicode_literals +from __future__ import absolute_import, print_function, unicode_literals __metaclass__ = type __all__ = [ @@ -29,7 +29,7 @@ __all__ = [ from zope.component import getUtility -from zope.interface import implements +from zope.interface import implementer from mailman.core.i18n import _ from mailman.email.message import UserNotification @@ -40,9 +40,9 @@ from mailman.utilities.string import oneline +@implementer(IHandler) class Acknowledge: """Send an acknowledgment.""" - implements(IHandler) name = 'acknowledge' description = _("""Send an acknowledgment of a posting.""") diff --git a/src/mailman/handlers/after_delivery.py b/src/mailman/handlers/after_delivery.py index a964804b5..0a3ba2c75 100644 --- a/src/mailman/handlers/after_delivery.py +++ b/src/mailman/handlers/after_delivery.py @@ -17,7 +17,7 @@ """Perform some bookkeeping after a successful post.""" -from __future__ import absolute_import, unicode_literals +from __future__ import absolute_import, print_function, unicode_literals __metaclass__ = type __all__ = [ @@ -25,7 +25,7 @@ __all__ = [ ] -from zope.interface import implements +from zope.interface import implementer from mailman.core.i18n import _ from mailman.interfaces.handler import IHandler @@ -33,11 +33,10 @@ from mailman.utilities.datetime import now +@implementer(IHandler) class AfterDelivery: """Perform some bookkeeping after a successful post.""" - implements(IHandler) - name = 'after-delivery' description = _('Perform some bookkeeping after a successful post.') diff --git a/src/mailman/handlers/avoid_duplicates.py b/src/mailman/handlers/avoid_duplicates.py index ffbc80c85..de1939822 100644 --- a/src/mailman/handlers/avoid_duplicates.py +++ b/src/mailman/handlers/avoid_duplicates.py @@ -23,7 +23,7 @@ has already received a copy, we either drop the message, add a duplicate warning header, or pass it through, depending on the user's preferences. """ -from __future__ import absolute_import, unicode_literals +from __future__ import absolute_import, print_function, unicode_literals __metaclass__ = type __all__ = [ @@ -32,7 +32,7 @@ __all__ = [ from email.utils import getaddresses, formataddr -from zope.interface import implements +from zope.interface import implementer from mailman.core.i18n import _ from mailman.interfaces.handler import IHandler @@ -42,11 +42,10 @@ COMMASPACE = ', ' +@implementer(IHandler) class AvoidDuplicates: """If the user wishes it, do not send duplicates of the same message.""" - implements(IHandler) - name = 'avoid-duplicates' description = _('Suppress some duplicates of the same message.') diff --git a/src/mailman/handlers/cleanse.py b/src/mailman/handlers/cleanse.py index 605b843d0..32d3455ca 100644 --- a/src/mailman/handlers/cleanse.py +++ b/src/mailman/handlers/cleanse.py @@ -17,7 +17,7 @@ """Cleanse certain headers from all messages.""" -from __future__ import absolute_import, unicode_literals +from __future__ import absolute_import, print_function, unicode_literals __metaclass__ = type __all__ = [ @@ -28,7 +28,7 @@ __all__ = [ import logging from email.utils import formataddr -from zope.interface import implements +from zope.interface import implementer from mailman.core.i18n import _ from mailman.handlers.cook_headers import uheader @@ -39,11 +39,10 @@ log = logging.getLogger('mailman.post') +@implementer(IHandler) class Cleanse: """Cleanse certain headers from all messages.""" - implements(IHandler) - name = 'cleanse' description = _('Cleanse certain headers from all messages.') diff --git a/src/mailman/handlers/cleanse_dkim.py b/src/mailman/handlers/cleanse_dkim.py index d2cd32636..bc23980b7 100644 --- a/src/mailman/handlers/cleanse_dkim.py +++ b/src/mailman/handlers/cleanse_dkim.py @@ -25,7 +25,7 @@ and it will also give the MTA the opportunity to regenerate valid keys originating at the Mailman server for the outgoing message. """ -from __future__ import absolute_import, unicode_literals +from __future__ import absolute_import, print_function, unicode_literals __metaclass__ = type __all__ = [ @@ -34,7 +34,7 @@ __all__ = [ from lazr.config import as_boolean -from zope.interface import implements +from zope.interface import implementer from mailman.config import config from mailman.core.i18n import _ @@ -42,11 +42,10 @@ from mailman.interfaces.handler import IHandler +@implementer(IHandler) class CleanseDKIM: """Remove DomainKeys headers.""" - implements(IHandler) - name = 'cleanse-dkim' description = _('Remove DomainKeys headers.') diff --git a/src/mailman/handlers/cook_headers.py b/src/mailman/handlers/cook_headers.py index 5d1e416a6..535155ab7 100644 --- a/src/mailman/handlers/cook_headers.py +++ b/src/mailman/handlers/cook_headers.py @@ -17,7 +17,7 @@ """Cook a message's headers.""" -from __future__ import absolute_import, unicode_literals +from __future__ import absolute_import, print_function, unicode_literals __metaclass__ = type __all__ = [ @@ -30,7 +30,7 @@ import re from email.errors import HeaderParseError from email.header import Header, decode_header, make_header from email.utils import parseaddr, formataddr, getaddresses -from zope.interface import implements +from zope.interface import implementer from mailman.core.i18n import _ from mailman.interfaces.handler import IHandler @@ -279,11 +279,10 @@ def ch_oneline(headerstr): +@implementer(IHandler) class CookHeaders: """Modify message headers.""" - implements(IHandler) - name = 'cook-headers' description = _('Modify message headers.') diff --git a/src/mailman/handlers/decorate.py b/src/mailman/handlers/decorate.py index d6d156048..c5fad2891 100644 --- a/src/mailman/handlers/decorate.py +++ b/src/mailman/handlers/decorate.py @@ -31,7 +31,7 @@ import logging from email.mime.text import MIMEText from urllib2 import URLError from zope.component import getUtility -from zope.interface import implements +from zope.interface import implementer from mailman.core.i18n import _ from mailman.email.message import Message @@ -57,7 +57,7 @@ def process(mlist, msg, msgdata): d['user_address'] = recipient d['user_delivered_to'] = member.address.original_email d['user_language'] = member.preferred_language.description - d['user_name'] = (member.user.display_name + d['user_name'] = (member.user.display_name if member.user.display_name else member.address.original_email) d['user_optionsurl'] = member.options_url @@ -232,11 +232,10 @@ def decorate(mlist, uri, extradict=None): +@implementer(IHandler) class Decorate: """Decorate a message with headers and footers.""" - implements(IHandler) - name = 'decorate' description = _('Decorate a message with headers and footers.') diff --git a/src/mailman/handlers/docs/rfc-2369.rst b/src/mailman/handlers/docs/rfc-2369.rst index 0461f27ba..875603f88 100644 --- a/src/mailman/handlers/docs/rfc-2369.rst +++ b/src/mailman/handlers/docs/rfc-2369.rst @@ -59,13 +59,14 @@ about hiding them. A list owner can turn these headers off. Messages which Mailman generates itself, such as user or owner notifications, have a reduced set of `List-` headers. Specifically, there is no `List-Post`, `List-Archive` or `Archived-At` header. +.. >>> mlist.include_rfc2369_headers = True - >>> mlist.include_list_post_header = False >>> msg = message_from_string("""\ ... From: aperson@example.com ... ... """) + >>> process(mlist, msg, dict(reduced_list_headers=True)) >>> list_headers(msg) ---start--- @@ -84,6 +85,7 @@ List-Post header Discussion lists, to which any subscriber can post, also have a `List-Post` header which contains the `mailto:` URL used to send messages to the list. + >>> mlist.include_rfc2369_headers = True >>> mlist.include_list_post_header = True >>> msg = message_from_string("""\ ... From: aperson@example.com @@ -101,6 +103,28 @@ header which contains the `mailto:` URL used to send messages to the list. <mailto:test-leave@example.com> ---end--- +Some mailing lists are announce, or one-way lists, not discussion lists. +Because the general membership cannot post to these mailing lists, the list +owner can set a flag which adds a special `List-Post` header value, according +to RFC 2369. + + >>> mlist.include_list_post_header = False + >>> msg = message_from_string("""\ + ... From: aperson@example.com + ... + ... """) + >>> process(mlist, msg, {}) + >>> list_headers(msg) + ---start--- + list-help: <mailto:test-request@example.com?subject=help> + list-id: <test.example.com> + list-post: NO + list-subscribe: <http://lists.example.com/listinfo/test@example.com>, + <mailto:test-join@example.com> + list-unsubscribe: <http://lists.example.com/listinfo/test@example.com>, + <mailto:test-leave@example.com> + ---end--- + List-Id header ============== @@ -108,6 +132,7 @@ List-Id header If the mailing list has a description, then it is included in the ``List-Id`` header. + >>> mlist.include_list_post_header = True >>> mlist.description = 'My test mailing list' >>> msg = message_from_string("""\ ... From: aperson@example.com diff --git a/src/mailman/handlers/file_recipients.py b/src/mailman/handlers/file_recipients.py index d087ff2bb..750357a90 100644 --- a/src/mailman/handlers/file_recipients.py +++ b/src/mailman/handlers/file_recipients.py @@ -17,7 +17,7 @@ """Get the normal delivery recipients from a Sendmail style :include: file.""" -from __future__ import absolute_import, unicode_literals +from __future__ import absolute_import, print_function, unicode_literals __metaclass__ = type __all__ = [ @@ -28,18 +28,17 @@ __all__ = [ import os import errno -from zope.interface import implements +from zope.interface import implementer from mailman.core.i18n import _ from mailman.interfaces.handler import IHandler +@implementer(IHandler) class FileRecipients: """Get the normal delivery recipients from an include file.""" - implements(IHandler) - name = 'file-recipients' description = _('Get the normal delivery recipients from an include file.') diff --git a/src/mailman/handlers/member_recipients.py b/src/mailman/handlers/member_recipients.py index 956ea6adc..ec8ed77b1 100644 --- a/src/mailman/handlers/member_recipients.py +++ b/src/mailman/handlers/member_recipients.py @@ -31,7 +31,7 @@ __all__ = [ ] -from zope.interface import implements +from zope.interface import implementer from mailman.config import config from mailman.core import errors @@ -42,11 +42,10 @@ from mailman.utilities.string import wrap +@implementer(IHandler) class MemberRecipients: """Calculate the regular (i.e. non-digest) recipients of the message.""" - implements(IHandler) - name = 'member-recipients' description = _('Calculate the regular recipients of the message.') diff --git a/src/mailman/handlers/mime_delete.py b/src/mailman/handlers/mime_delete.py index c9c1eb408..52fcc99fa 100644 --- a/src/mailman/handlers/mime_delete.py +++ b/src/mailman/handlers/mime_delete.py @@ -24,7 +24,7 @@ wrapping only single sections after other processing are replaced by their contents. """ -from __future__ import absolute_import, unicode_literals +from __future__ import absolute_import, print_function, unicode_literals __metaclass__ = type __all__ = [ @@ -42,7 +42,7 @@ from email.mime.message import MIMEMessage from email.mime.text import MIMEText from lazr.config import as_boolean from os.path import splitext -from zope.interface import implements +from zope.interface import implementer from mailman.config import config from mailman.core import errors @@ -285,11 +285,10 @@ def get_file_ext(m): +@implementer(IHandler) class MIMEDelete: """Filter the MIME content of messages.""" - implements(IHandler) - name = 'mime-delete' description = _('Filter the MIME content of messages.') diff --git a/src/mailman/handlers/owner_recipients.py b/src/mailman/handlers/owner_recipients.py index e431d00cf..66c380635 100644 --- a/src/mailman/handlers/owner_recipients.py +++ b/src/mailman/handlers/owner_recipients.py @@ -25,7 +25,7 @@ __all__ = [ ] -from zope.interface import implements +from zope.interface import implementer from mailman.config import config from mailman.core.i18n import _ @@ -34,11 +34,10 @@ from mailman.interfaces.member import DeliveryStatus +@implementer(IHandler) class OwnerRecipients: """Calculate the owner (and moderator) recipients for -owner postings.""" - implements(IHandler) - name = 'owner-recipients' description = _('Calculate the owner and moderator recipients.') diff --git a/src/mailman/handlers/replybot.py b/src/mailman/handlers/replybot.py index 83aa40214..a25f4f30b 100644 --- a/src/mailman/handlers/replybot.py +++ b/src/mailman/handlers/replybot.py @@ -17,7 +17,7 @@ """Handler for automatic responses.""" -from __future__ import absolute_import, unicode_literals +from __future__ import absolute_import, print_function, unicode_literals __metaclass__ = type __all__ = [ @@ -28,7 +28,7 @@ __all__ = [ import logging from zope.component import getUtility -from zope.interface import implements +from zope.interface import implementer from mailman.core.i18n import _ from mailman.email.message import UserNotification @@ -44,11 +44,10 @@ log = logging.getLogger('mailman.error') +@implementer(IHandler) class Replybot: """Send automatic responses.""" - implements(IHandler) - name = 'replybot' description = _('Send automatic responses.') diff --git a/src/mailman/handlers/rfc_2369.py b/src/mailman/handlers/rfc_2369.py index ece4e83cb..ea7b9e8dc 100644 --- a/src/mailman/handlers/rfc_2369.py +++ b/src/mailman/handlers/rfc_2369.py @@ -17,7 +17,7 @@ """RFC 2369 List-* and related headers.""" -from __future__ import absolute_import, unicode_literals +from __future__ import absolute_import, print_function, unicode_literals __metaclass__ = type __all__ = [ @@ -26,7 +26,7 @@ __all__ = [ from email.utils import formataddr -from zope.interface import implements +from zope.interface import implementer from mailman.config import config from mailman.core.i18n import _ @@ -74,9 +74,13 @@ def process(mlist, msg, msgdata): 'List-Subscribe' : subfieldfmt.format(listinfo, mlist.join_address), }) if not msgdata.get('reduced_list_headers'): - # List-Post: is controlled by a separate attribute - if mlist.include_list_post_header: - headers['List-Post'] = '<mailto:{0}>'.format(mlist.posting_address) + # List-Post: is controlled by a separate attribute, which is somewhat + # misnamed. RFC 2369 requires a value of NO if posting is not + # allowed, i.e. for an announce-only list. + list_post = ('<mailto:{0}>'.format(mlist.posting_address) + if mlist.include_list_post_header + else 'NO') + headers['List-Post'] = list_post # Add RFC 2369 and 5064 archiving headers, if archiving is enabled. if mlist.archive: for archiver in config.archivers: @@ -100,11 +104,10 @@ def process(mlist, msg, msgdata): +@implementer(IHandler) class RFC2369: """Add the RFC 2369 List-* headers.""" - implements(IHandler) - name = 'rfc-2369' description = _('Add the RFC 2369 List-* headers.') diff --git a/src/mailman/handlers/tagger.py b/src/mailman/handlers/tagger.py index 49e004a12..9d78372e6 100644 --- a/src/mailman/handlers/tagger.py +++ b/src/mailman/handlers/tagger.py @@ -17,7 +17,7 @@ """Extract topics from the original mail message.""" -from __future__ import absolute_import, unicode_literals +from __future__ import absolute_import, print_function, unicode_literals __metaclass__ = type __all__ = [ @@ -29,7 +29,7 @@ import re import email.iterators import email.parser -from zope.interface import implements +from zope.interface import implementer from mailman.core.i18n import _ from mailman.interfaces.handler import IHandler @@ -178,11 +178,10 @@ class _ForgivingParser(email.parser.HeaderParser): +@implementer(IHandler) class Tagger: """Tag messages with topic matches.""" - implements(IHandler) - name = 'tagger' description = _('Tag messages with topic matches.') diff --git a/src/mailman/handlers/to_archive.py b/src/mailman/handlers/to_archive.py index fd5259a14..0dc5bad1a 100644 --- a/src/mailman/handlers/to_archive.py +++ b/src/mailman/handlers/to_archive.py @@ -17,7 +17,7 @@ """Add the message to the archives.""" -from __future__ import absolute_import, unicode_literals +from __future__ import absolute_import, print_function, unicode_literals __metaclass__ = type __all__ = [ @@ -25,7 +25,7 @@ __all__ = [ ] -from zope.interface import implements +from zope.interface import implementer from mailman.config import config from mailman.core.i18n import _ @@ -33,11 +33,10 @@ from mailman.interfaces.handler import IHandler +@implementer(IHandler) class ToArchive: """Add the message to the archives.""" - implements(IHandler) - name = 'to-archive' description = _('Add the message to the archives.') diff --git a/src/mailman/handlers/to_digest.py b/src/mailman/handlers/to_digest.py index 71511f136..8067e2c0c 100644 --- a/src/mailman/handlers/to_digest.py +++ b/src/mailman/handlers/to_digest.py @@ -17,7 +17,7 @@ """Add the message to the list's current digest.""" -from __future__ import absolute_import, unicode_literals +from __future__ import absolute_import, print_function, unicode_literals __metaclass__ = type __all__ = [ @@ -27,7 +27,7 @@ __all__ = [ import os -from zope.interface import implements +from zope.interface import implementer from mailman.config import config from mailman.core.i18n import _ @@ -39,11 +39,10 @@ from mailman.utilities.mailbox import Mailbox +@implementer(IHandler) class ToDigest: """Add the message to the digest, possibly sending it.""" - implements(IHandler) - name = 'to-digest' description = _('Add the message to the digest, possibly sending it.') diff --git a/src/mailman/handlers/to_outgoing.py b/src/mailman/handlers/to_outgoing.py index 971f87757..a212485c7 100644 --- a/src/mailman/handlers/to_outgoing.py +++ b/src/mailman/handlers/to_outgoing.py @@ -22,7 +22,7 @@ posted to the list membership. Anything else that needs to go out to some recipient should just be placed in the out queue directly. """ -from __future__ import absolute_import, unicode_literals +from __future__ import absolute_import, print_function, unicode_literals __metaclass__ = type __all__ = [ @@ -30,7 +30,7 @@ __all__ = [ ] -from zope.interface import implements +from zope.interface import implementer from mailman.config import config from mailman.core.i18n import _ @@ -38,11 +38,10 @@ from mailman.interfaces.handler import IHandler +@implementer(IHandler) class ToOutgoing: """Send the message to the outgoing queue.""" - implements(IHandler) - name = 'to-outgoing' description = _('Send the message to the outgoing queue.') diff --git a/src/mailman/handlers/to_usenet.py b/src/mailman/handlers/to_usenet.py index 021f8f9e5..79f4c9b1b 100644 --- a/src/mailman/handlers/to_usenet.py +++ b/src/mailman/handlers/to_usenet.py @@ -27,7 +27,7 @@ __all__ = [ import logging -from zope.interface import implements +from zope.interface import implementer from mailman.config import config from mailman.core.i18n import _ @@ -39,11 +39,10 @@ log = logging.getLogger('mailman.error') +@implementer(IHandler) class ToUsenet: """Move the message to the outgoing news queue.""" - implements(IHandler) - name = 'to-usenet' description = _('Move the message to the outgoing news queue.') |
