From c1cc921b691eb60445cf28bc66a59b02b3cd09a4 Mon Sep 17 00:00:00 2001 From: Barry Warsaw Date: Wed, 30 Jan 2008 23:58:52 -0500 Subject: Reorganization. Create a Mailman.chains package and move a bunch of the Mailman.apps.chains classes to separate modules under this package. Also, separate out iteration from chain management. In other words, IChain and IChainIterator are separate, and the latter is retrieved from the former by the .get_links() method. This latter takes the mailing list, message, and metadata dictionary so that links can be targetted specifically to the task at hand. --- Mailman/interfaces/chain.py | 26 ++++++++++++++++++++------ 1 file changed, 20 insertions(+), 6 deletions(-) (limited to 'Mailman/interfaces/chain.py') diff --git a/Mailman/interfaces/chain.py b/Mailman/interfaces/chain.py index eca663b30..63d7eb7f7 100644 --- a/Mailman/interfaces/chain.py +++ b/Mailman/interfaces/chain.py @@ -63,12 +63,6 @@ class IChain(Interface): name = Attribute('Chain name; must be unique.') description = Attribute('A brief description of the chain.') - def __iter__(): - """Iterate over all the IChainLinks in this chain. - - :return: an IChainLink. - """ - def get_rule(name): """Lookup and return the named rule. @@ -79,6 +73,26 @@ class IChain(Interface): :raises: KeyError if the named rule cannot be found. """ + def get_links(mlist, msg, msgdata): + """Get an `IChainIterator` for processing. + + :param mlist: the IMailingList object + :param msg: the message being processed + :param msgdata: the message metadata dictionary + :return: An `IChainIterator`. + """ + + + +class IChainIterator(Interface): + """An iterator over chain rules.""" + + def __iter__(): + """Iterate over all the IChainLinks in this chain. + + :return: an IChainLink. + """ + class IMutableChain(IChain): -- cgit v1.2.3-70-g09d2