summaryrefslogtreecommitdiff
path: root/Mailman/rules/truth.py
diff options
context:
space:
mode:
authorBarry Warsaw2008-02-01 22:21:05 -0500
committerBarry Warsaw2008-02-01 22:21:05 -0500
commitb6f3ba4c9ebe821dd2c4676d7397fe5312b72a36 (patch)
tree5803f890642e5272b856e30869abd630b43271bc /Mailman/rules/truth.py
parentc1cc921b691eb60445cf28bc66a59b02b3cd09a4 (diff)
downloadmailman-b6f3ba4c9ebe821dd2c4676d7397fe5312b72a36.tar.gz
mailman-b6f3ba4c9ebe821dd2c4676d7397fe5312b72a36.tar.zst
mailman-b6f3ba4c9ebe821dd2c4676d7397fe5312b72a36.zip
SpamDetect is gone, so the chains/rules implementation experiment is deemed a
success and will now be merged into the trunk. Move the Truth rule into the built-in rules package in a separate module, and add a test. Modify IChainLink so that the rule and chain attributes are not names but indeed the actual ILink or IChain object directly. Update the chains.process() function accordingly. Remove the IChain.get_rule() method. Don't derive BuiltInChain from Chain and don't make it an IMutableChain. It's now just an IChain, and is implemented concretely. Refactor the HeaderMatchChain and friends so that it can be used with both the global HEADER_MATCHES variable and the list-specific header_matches variable, which has exactly the same semantics. Oh yeah, get rid of the list's header_filter_rules attribute and replace it with header_matches so that the semantics match, it's easy to explain, and it's all nice and clean.
Diffstat (limited to '')
-rw-r--r--Mailman/rules/truth.py41
1 files changed, 41 insertions, 0 deletions
diff --git a/Mailman/rules/truth.py b/Mailman/rules/truth.py
new file mode 100644
index 000000000..d3cfc30f3
--- /dev/null
+++ b/Mailman/rules/truth.py
@@ -0,0 +1,41 @@
+# Copyright (C) 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.
+
+"""A rule which always matches."""
+
+__all__ = ['Truth']
+__metaclass__ = type
+
+
+from zope.interface import implements
+
+from Mailman.i18n import _
+from Mailman.interfaces import IRule
+
+
+
+class Truth:
+ """Look for any previous rule match."""
+ implements(IRule)
+
+ name = 'truth'
+ description = _('A rule which always matches.')
+ record = False
+
+ def check(self, mlist, msg, msgdata):
+ """See `IRule`."""
+ return True