summaryrefslogtreecommitdiff
path: root/Mailman/chains/builtin.py
diff options
context:
space:
mode:
authorBarry Warsaw2008-01-30 23:58:52 -0500
committerBarry Warsaw2008-01-30 23:58:52 -0500
commitc1cc921b691eb60445cf28bc66a59b02b3cd09a4 (patch)
tree3af37f53607a37a945ffbf81ce21454d8e9fc776 /Mailman/chains/builtin.py
parent7b853f27c34c2a168b5dbbf796b84517a20c6191 (diff)
downloadmailman-c1cc921b691eb60445cf28bc66a59b02b3cd09a4.tar.gz
mailman-c1cc921b691eb60445cf28bc66a59b02b3cd09a4.tar.zst
mailman-c1cc921b691eb60445cf28bc66a59b02b3cd09a4.zip
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.
Diffstat (limited to 'Mailman/chains/builtin.py')
-rw-r--r--Mailman/chains/builtin.py59
1 files changed, 59 insertions, 0 deletions
diff --git a/Mailman/chains/builtin.py b/Mailman/chains/builtin.py
new file mode 100644
index 000000000..e5e97c3fb
--- /dev/null
+++ b/Mailman/chains/builtin.py
@@ -0,0 +1,59 @@
+# Copyright (C) 2007-2008 by the Free Software Foundation, Inc.
+#
+# This program 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 2
+# of the License, or (at your option) any later version.
+#
+# This program 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 this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
+# USA.
+
+"""The default built-in starting chain."""
+
+__all__ = ['BuiltInChain']
+__metaclass__ = type
+
+
+import logging
+
+from Mailman.interfaces import LinkAction
+from Mailman.chains.base import Chain, Link
+from Mailman.i18n import _
+
+
+log = logging.getLogger('mailman.vette')
+
+
+
+class BuiltInChain(Chain):
+ """Default built-in chain."""
+
+ def __init__(self):
+ super(BuiltInChain, self).__init__(
+ 'built-in', _('The built-in moderation chain.'))
+ self.append_link(Link('approved', LinkAction.jump, 'accept'))
+ self.append_link(Link('emergency', LinkAction.jump, 'hold'))
+ self.append_link(Link('loop', LinkAction.jump, 'discard'))
+ # Do all of the following before deciding whether to hold the message
+ # for moderation.
+ self.append_link(Link('administrivia', LinkAction.defer))
+ self.append_link(Link('implicit-dest', LinkAction.defer))
+ self.append_link(Link('max-recipients', LinkAction.defer))
+ self.append_link(Link('max-size', LinkAction.defer))
+ self.append_link(Link('news-moderation', LinkAction.defer))
+ self.append_link(Link('no-subject', LinkAction.defer))
+ self.append_link(Link('suspicious-header', LinkAction.defer))
+ # Now if any of the above hit, jump to the hold chain.
+ self.append_link(Link('any', LinkAction.jump, 'hold'))
+ # Take a detour through the self header matching chain, which we'll
+ # create later.
+ self.append_link(Link('truth', LinkAction.detour, 'header-match'))
+ # Finally, the builtin chain selfs to acceptance.
+ self.append_link(Link('truth', LinkAction.jump, 'accept'))