summaryrefslogtreecommitdiff
path: root/src/mailman/rules/docs/loop.rst
diff options
context:
space:
mode:
authorBarry Warsaw2011-09-23 21:42:39 -0400
committerBarry Warsaw2011-09-23 21:42:39 -0400
commit48354a7e6814190455fb566947ab952062ecde76 (patch)
tree874a9afe0c5ca798a83daa8c6462da6ecaecb2bf /src/mailman/rules/docs/loop.rst
parent87966acc80cf4dabfb7f9d3019f62483376e2037 (diff)
downloadmailman-48354a7e6814190455fb566947ab952062ecde76.tar.gz
mailman-48354a7e6814190455fb566947ab952062ecde76.tar.zst
mailman-48354a7e6814190455fb566947ab952062ecde76.zip
Finally, all doctests are named .rst
Diffstat (limited to 'src/mailman/rules/docs/loop.rst')
-rw-r--r--src/mailman/rules/docs/loop.rst49
1 files changed, 49 insertions, 0 deletions
diff --git a/src/mailman/rules/docs/loop.rst b/src/mailman/rules/docs/loop.rst
new file mode 100644
index 000000000..716029065
--- /dev/null
+++ b/src/mailman/rules/docs/loop.rst
@@ -0,0 +1,49 @@
+=============
+Posting loops
+=============
+
+To avoid a posting loop, Mailman has a rule to check for the existence of an
+RFC 2369 ``List-Post:`` header with the value of the list's posting address.
+
+ >>> mlist = create_list('_xtest@example.com')
+ >>> rule = config.rules['loop']
+ >>> print rule.name
+ loop
+
+The header could be missing, in which case the rule does not match.
+
+ >>> msg = message_from_string("""\
+ ... From: aperson@example.com
+ ...
+ ... An important message.
+ ... """)
+ >>> rule.check(mlist, msg, {})
+ False
+
+The header could be present, but not match the list's posting address.
+
+ >>> msg['List-Post'] = 'not-this-list@example.com'
+ >>> rule.check(mlist, msg, {})
+ False
+
+If the header is present and does match the posting address, the rule
+matches.
+
+ >>> del msg['list-post']
+ >>> msg['List-Post'] = mlist.posting_address
+ >>> rule.check(mlist, msg, {})
+ True
+
+Even if there are multiple ``List-Post:`` headers, as long as one with the
+posting address exists, the rule matches.
+
+ >>> msg = message_from_string("""\
+ ... From: aperson@example.com
+ ... List-Post: not-this-list@example.com
+ ... List-Post: _xtest@example.com
+ ... List-Post: foo@example.com
+ ...
+ ... An important message.
+ ... """)
+ >>> rule.check(mlist, msg, {})
+ True