summaryrefslogtreecommitdiff
path: root/src/mailman/rules/docs/news-moderation.txt
blob: 4c095cc81c289340e49ec254c68a55edfa8c18ef (plain) (blame)
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
Newsgroup moderation
====================

The 'news-moderation' rule matches all messages posted to mailing lists that
gateway to a moderated newsgroup.  The reason for this is that such messages
must get forwarded on to the newsgroup moderator.  From there it will get
posted to the newsgroup, and from there, gated to the mailing list.  It's a
circuitous route, but it works nonetheless by holding all messages posted
directly to the mailing list.

    >>> mlist = config.db.list_manager.create(u'_xtest@example.com')
    >>> rule = config.rules['news-moderation']
    >>> print rule.name
    news-moderation

Set the list configuraiton variable to enable newsgroup moderation.

    >>> from mailman.interfaces import NewsModeration
    >>> mlist.news_moderation = NewsModeration.moderated

And now all messages will match the rule.

    >>> msg = message_from_string("""\
    ... From: aperson@example.org
    ... Subject: An announcment
    ...
    ... Great things are happening.
    ... """)
    >>> rule.check(mlist, msg, {})
    True

When moderation is turned off, the rule does not match.

    >>> mlist.news_moderation = NewsModeration.none
    >>> rule.check(mlist, msg, {})
    False