diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/mailman/interfaces/mta.py | 28 | ||||
| -rw-r--r-- | src/mailman/mta/bulk.py | 40 | ||||
| -rw-r--r-- | src/mailman/mta/docs/bulk.txt | 24 | ||||
| -rw-r--r-- | src/mailman/mta/null.py | 10 | ||||
| -rw-r--r-- | src/mailman/mta/postfix.py | 8 | ||||
| -rw-r--r-- | src/mailman/testing/mta.py | 4 |
6 files changed, 100 insertions, 14 deletions
diff --git a/src/mailman/interfaces/mta.py b/src/mailman/interfaces/mta.py index a8c794750..3dd1793e5 100644 --- a/src/mailman/interfaces/mta.py +++ b/src/mailman/interfaces/mta.py @@ -21,7 +21,8 @@ from __future__ import absolute_import, unicode_literals __metaclass__ = type __all__ = [ - 'IMailTransportAgent', + 'IMailTransportAgentAliases', + 'IMailTransportAgentDelivery', ] @@ -29,8 +30,8 @@ from zope.interface import Interface -class IMailTransportAgent(Interface): - """Interface to the MTA.""" +class IMailTransportAgentAliases(Interface): + """Interface to the MTA aliases generator.""" def create(mlist): """Tell the MTA that the mailing list was created.""" @@ -40,3 +41,24 @@ class IMailTransportAgent(Interface): def regenerate(): """Regenerate the full aliases file.""" + + + +class IMailTransportAgentDelivery(Interface): + """Interface to the MTA delivery strategies.""" + + def deliver(mlist, msg, msgdata): + """Deliver a message to a mailing list's recipients. + + Ordinarily the mailing list is consulted for delivery specifics, + however the message metadata dictionary can contain additional + directions to control delivery. Specifics are left to the + implementation. + + :param mlist: The mailing list being delivered to. + :type mlist: `IMailingList` + :param msg: The original message being delivered. + :type msg: `Message` + :param msgdata: Additional message metadata for this delivery. + :type msgdata: dictionary + """ diff --git a/src/mailman/mta/bulk.py b/src/mailman/mta/bulk.py new file mode 100644 index 000000000..12f94cc23 --- /dev/null +++ b/src/mailman/mta/bulk.py @@ -0,0 +1,40 @@ +# Copyright (C) 2009 by the Free Software Foundation, Inc. +# +# This file is part of GNU Mailman. +# +# GNU Mailman is free software: you can redistribute it and/or modify it under +# the terms of the GNU General Public License as published by the Free +# Software Foundation, either version 3 of the License, or (at your option) +# any later version. +# +# GNU Mailman is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for +# more details. +# +# You should have received a copy of the GNU General Public License along with +# GNU Mailman. If not, see <http://www.gnu.org/licenses/>. + +"""Module stuff.""" + +from __future__ import absolute_import, unicode_literals + +__metaclass__ = type +__all__ = [ + 'BulkDelivery', + ] + + +from zope.interface import implements + +from mailman.interfaces.mta import IMailTransportAgentDelivery + + + +class BulkDelivery: + """Deliver messages to the MTA in as few sessions as possible.""" + + implements(IMailTransportAgentDelivery) + + def deliver(self, mlist, msg, msgdata): + """See `IMailTransportAgentDelivery`.""" diff --git a/src/mailman/mta/docs/bulk.txt b/src/mailman/mta/docs/bulk.txt new file mode 100644 index 000000000..4f564173d --- /dev/null +++ b/src/mailman/mta/docs/bulk.txt @@ -0,0 +1,24 @@ +====================== +Standard bulk delivery +====================== + +Mailman has several built in strategies for completing the actual delivery of +messages to the immediate upstream mail transport agent, which completes the +actual final delivery to recipients. + +Bulk delivery attempts to deliver as few copies of the identical message as +possible to as many recipients as possible. By grouping recipients this way, +bandwidth between Mailman and the MTA, and consequently between the MTA and +remote mail servers, can be greatly reduced. The downside is the messages +cannot be personalized. See `verp.txt`_ for an alternative strategy. + + >>> from mailman.mta.bulk import BulkDelivery + +Delivery strategies must implement the proper interface. + + >>> bulk = BulkDelivery() + + >>> from mailman.interfaces.mta import IMailTransportAgentDelivery + >>> from zope.interface.verify import verifyObject + >>> verifyObject(IMailTransportAgentDelivery, bulk) + True diff --git a/src/mailman/mta/null.py b/src/mailman/mta/null.py index 07cb7a869..5670d7c7f 100644 --- a/src/mailman/mta/null.py +++ b/src/mailman/mta/null.py @@ -29,23 +29,23 @@ __all__ = [ from zope.interface import implements -from mailman.interfaces.mta import IMailTransportAgent +from mailman.interfaces.mta import IMailTransportAgentAliases class NullMTA: """Null MTA that just satisfies the interface.""" - implements(IMailTransportAgent) + implements(IMailTransportAgentAliases) def create(self, mlist): - """See `IMailTransportAgent`.""" + """See `IMailTransportAgentAliases`.""" pass def delete(self, mlist): - """See `IMailTransportAgent`.""" + """See `IMailTransportAgentAliases`.""" pass def regenerate(self): - """See `IMailTransportAgent`.""" + """See `IMailTransportAgentAliases`.""" pass diff --git a/src/mailman/mta/postfix.py b/src/mailman/mta/postfix.py index d68c3d19b..4ddf444af 100644 --- a/src/mailman/mta/postfix.py +++ b/src/mailman/mta/postfix.py @@ -40,7 +40,7 @@ from zope.interface import implements from mailman import Utils from mailman.config import config from mailman.interfaces.listmanager import IListManager -from mailman.interfaces.mta import IMailTransportAgent +from mailman.interfaces.mta import IMailTransportAgentAliases from mailman.i18n import _ log = logging.getLogger('mailman.error') @@ -56,10 +56,10 @@ SUBDESTINATIONS = ( class LMTP: """Connect Mailman to Postfix via LMTP.""" - implements(IMailTransportAgent) + implements(IMailTransportAgentAliases) def create(self, mlist): - """See `IMailTransportAgent`.""" + """See `IMailTransportAgentAliases`.""" # Acquire a lock file to prevent other processes from racing us here. with Lock(LOCKFILE): # We can ignore the mlist argument because for LMTP delivery, we @@ -69,7 +69,7 @@ class LMTP: delete = create def regenerate(self): - """See `IMailTransportAgent`.""" + """See `IMailTransportAgentAliases`.""" # Acquire a lock file to prevent other processes from racing us here. with Lock(LOCKFILE): self._do_write_file() diff --git a/src/mailman/testing/mta.py b/src/mailman/testing/mta.py index 62070cc5d..6e0ee45b9 100644 --- a/src/mailman/testing/mta.py +++ b/src/mailman/testing/mta.py @@ -33,7 +33,7 @@ from lazr.smtptest.controller import QueueController from lazr.smtptest.server import Channel, QueueServer from zope.interface import implements -from mailman.interfaces.mta import IMailTransportAgent +from mailman.interfaces.mta import IMailTransportAgentAliases log = logging.getLogger('lazr.smtptest') @@ -43,7 +43,7 @@ log = logging.getLogger('lazr.smtptest') class FakeMTA: """Fake MTA for testing purposes.""" - implements(IMailTransportAgent) + implements(IMailTransportAgentAliases) def create(self, mlist): pass |
