summaryrefslogtreecommitdiff
path: root/src/mailman/rules
diff options
context:
space:
mode:
authorAurélien Bompard2015-09-14 11:16:45 +0200
committerBarry Warsaw2015-10-20 21:10:35 -0400
commit87f2f50b08eb0a7b0a99924b82fd246a6ce10983 (patch)
treeafed6065fb39fe3fae3b6d82ba97d142ad7b0f0e /src/mailman/rules
parente2f6b111f0bbf2287fbf793cd6f09fb829ee9758 (diff)
downloadmailman-87f2f50b08eb0a7b0a99924b82fd246a6ce10983.tar.gz
mailman-87f2f50b08eb0a7b0a99924b82fd246a6ce10983.tar.zst
mailman-87f2f50b08eb0a7b0a99924b82fd246a6ce10983.zip
Use and interface for the set of header_matches
Diffstat (limited to 'src/mailman/rules')
-rw-r--r--src/mailman/rules/docs/header-matching.rst12
1 files changed, 5 insertions, 7 deletions
diff --git a/src/mailman/rules/docs/header-matching.rst b/src/mailman/rules/docs/header-matching.rst
index c552ea521..05d01efb2 100644
--- a/src/mailman/rules/docs/header-matching.rst
+++ b/src/mailman/rules/docs/header-matching.rst
@@ -131,10 +131,9 @@ action.
The list administrator wants to match not on four stars, but on three plus
signs, but only for the current mailing list.
- >>> from mailman.model.mailinglist import HeaderMatch
- >>> mlist.header_matches = [
- ... HeaderMatch(header='x-spam-score', pattern='[+]{3,}')
- ... ]
+ >>> from mailman.interfaces.mailinglist import IHeaderMatchSet
+ >>> header_matches = IHeaderMatchSet(mlist)
+ >>> header_matches.add('x-spam-score', '[+]{3,}')
A message with a spam score of two pluses does not match.
@@ -178,9 +177,8 @@ As does a message with a spam score of four pluses.
Now, the list administrator wants to match on three plus signs, but wants those
emails to be discarded instead of held.
- >>> mlist.header_matches = [
- ... HeaderMatch(header='x-spam-score', pattern='[+]{3,}', chain='discard')
- ... ]
+ >>> header_matches.remove('x-spam-score', '[+]{3,}')
+ >>> header_matches.add('x-spam-score', '[+]{3,}', 'discard')
A message with a spam score of three pluses will still match, and the message
will be discarded.