1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
|
=============
Posting loops
=============
To avoid a posting loop, Mailman has a rule to check for the existence of an
X-BeenThere 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['X-BeenThere'] = '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['x-beenthere']
>>> msg['X-BeenThere'] = mlist.posting_address
>>> rule.check(mlist, msg, {})
True
Even if there are multiple X-BeenThere headers, as long as one with the
posting address exists, the rule matches.
>>> msg = message_from_string("""\
... From: aperson@example.com
... X-BeenThere: not-this-list@example.com
... X-BeenThere: _xtest@example.com
... X-BeenThere: foo@example.com
...
... An important message.
... """)
>>> rule.check(mlist, msg, {})
True
|