diff options
| author | Barry Warsaw | 2011-09-23 21:42:39 -0400 |
|---|---|---|
| committer | Barry Warsaw | 2011-09-23 21:42:39 -0400 |
| commit | 48354a7e6814190455fb566947ab952062ecde76 (patch) | |
| tree | 874a9afe0c5ca798a83daa8c6462da6ecaecb2bf /src/mailman/rules/docs/loop.rst | |
| parent | 87966acc80cf4dabfb7f9d3019f62483376e2037 (diff) | |
| download | mailman-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.rst | 49 |
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 |
