4
The 'news-moderation' rule matches all messages posted to mailing lists that
5
gateway to a moderated newsgroup. The reason for this is that such messages
6
must get forwarded on to the newsgroup moderator. From there it will get
7
posted to the newsgroup, and from there, gated to the mailing list. It's a
8
circuitous route, but it works nonetheless by holding all messages posted
9
directly to the mailing list.
11
>>> from Mailman.configuration import config
12
>>> mlist = config.db.list_manager.create(u'_xtest@example.com')
13
>>> rule = config.rules['news-moderation']
17
Set the list configuraiton variable to enable newsgroup moderation.
19
>>> from Mailman.interfaces import NewsModeration
20
>>> mlist.news_moderation = NewsModeration.moderated
22
And now all messages will match the rule.
24
>>> msg = message_from_string(u"""\
25
... From: aperson@example.org
26
... Subject: An announcment
28
... Great things are happening.
30
>>> rule.check(mlist, msg, {})
33
When moderation is turned off, the rule does not match.
35
>>> mlist.news_moderation = NewsModeration.none
36
>>> rule.check(mlist, msg, {})