summaryrefslogtreecommitdiff
path: root/Mailman/docs
diff options
context:
space:
mode:
Diffstat (limited to 'Mailman/docs')
-rw-r--r--Mailman/docs/hold.txt37
-rw-r--r--Mailman/docs/suspicious.txt37
2 files changed, 37 insertions, 37 deletions
diff --git a/Mailman/docs/hold.txt b/Mailman/docs/hold.txt
index 16948331f..1b8ecea59 100644
--- a/Mailman/docs/hold.txt
+++ b/Mailman/docs/hold.txt
@@ -57,43 +57,6 @@ handler returns immediately.
{'approved': True}
-Suspicious headers
-------------------
-
-Suspicious headers are a way for Mailman to hold messages that match a
-particular regular expression. This mostly historical feature is fairly
-confusing to users, and the list attribute that controls this is misnamed.
-
- >>> mlist.bounce_matching_headers = u'From: .*person@(blah.)?example.com'
- >>> msg = message_from_string("""\
- ... From: aperson@example.com
- ... To: _xtest@example.com
- ... Subject: An implicit message
- ...
- ... """)
- >>> process(mlist, msg, {})
- Traceback (most recent call last):
- ...
- SuspiciousHeaders
- >>> clear()
-
-But if the header doesn't match the regular expression, it'll get posted just
-fine. This one comes from a .org address.
-
- >>> msg = message_from_string("""\
- ... From: aperson@example.org
- ... To: _xtest@example.com
- ... Subject: An implicit message
- ...
- ... """)
- >>> msgdata = {}
- >>> process(mlist, msg, msgdata)
- >>> print msgdata
- {}
-
-Just a bit of clean up.
-
- >>> mlist.bounce_matching_headers = None
X Hold Notifications
diff --git a/Mailman/docs/suspicious.txt b/Mailman/docs/suspicious.txt
new file mode 100644
index 000000000..8646e1b81
--- /dev/null
+++ b/Mailman/docs/suspicious.txt
@@ -0,0 +1,37 @@
+Suspicious headers
+==================
+
+Suspicious headers are a way for Mailman to hold messages that match a
+particular regular expression. This mostly historical feature is fairly
+confusing to users, and the list attribute that controls this is misnamed.
+
+ >>> from Mailman.configuration import config
+ >>> mlist = config.db.list_manager.create(u'_xtest@example.com')
+ >>> from Mailman.app.rules import find_rule
+ >>> rule = find_rule('suspicious-header')
+ >>> rule.name
+ 'suspicious-header'
+
+Set the so-called suspicious header configuration variable.
+
+ >>> mlist.bounce_matching_headers = u'From: .*person@(blah.)?example.com'
+ >>> msg = message_from_string(u"""\
+ ... From: aperson@example.com
+ ... To: _xtest@example.com
+ ... Subject: An implicit message
+ ...
+ ... """)
+ >>> rule.check(mlist, msg, {})
+ True
+
+But if the header doesn't match the regular expression, the rule won't match.
+This one comes from a .org address.
+
+ >>> msg = message_from_string(u"""\
+ ... From: aperson@example.org
+ ... To: _xtest@example.com
+ ... Subject: An implicit message
+ ...
+ ... """)
+ >>> rule.check(mlist, msg, {})
+ False