diff options
| author | Barry Warsaw | 2016-04-01 15:14:51 -0400 |
|---|---|---|
| committer | Barry Warsaw | 2016-04-01 15:14:51 -0400 |
| commit | f7e9e4698bdd4cee39c9eb485296cbbfa32369a9 (patch) | |
| tree | 6dc8557009cbddb4e416faecc329b38b1cc0ad0b /src/mailman/rules/docs | |
| parent | afdd3b6deb32cd8cfdad291aba173a63064514f8 (diff) | |
| download | mailman-f7e9e4698bdd4cee39c9eb485296cbbfa32369a9.tar.gz mailman-f7e9e4698bdd4cee39c9eb485296cbbfa32369a9.tar.zst mailman-f7e9e4698bdd4cee39c9eb485296cbbfa32369a9.zip | |
Allow fall backs for moderation actions.
The `moderation_action` for members and nonmember can now be ``None``
which signals falling back to the appropriate list default action,
e.g. `default_member_action` and `default_nonmember_action`. Given by
Aurélien Bompard.
Closes #189
Diffstat (limited to 'src/mailman/rules/docs')
| -rw-r--r-- | src/mailman/rules/docs/moderation.rst | 41 |
1 files changed, 26 insertions, 15 deletions
diff --git a/src/mailman/rules/docs/moderation.rst b/src/mailman/rules/docs/moderation.rst index 56602189b..d1cc5fd67 100644 --- a/src/mailman/rules/docs/moderation.rst +++ b/src/mailman/rules/docs/moderation.rst @@ -3,9 +3,9 @@ Moderation ========== All members and nonmembers have a moderation action, which defaults to the -list's default action. When the action is not `defer`, the `moderation` rule -flags the message as needing moderation. This might be to automatically -accept, discard, reject, or hold the message. +appropriate list's default action. When the action is not `defer`, the +`moderation` rule flags the message as needing moderation. This might be to +automatically accept, discard, reject, or hold the message. Two separate rules check for member and nonmember moderation. Member moderation happens early in the built-in chain, while nonmember moderation @@ -22,15 +22,19 @@ Member moderation member-moderation Anne, a mailing list member, sends a message to the mailing list. Her -postings are not moderated. -:: +moderation action is not set. >>> from mailman.testing.helpers import subscribe - >>> subscribe(mlist, 'Anne') + >>> member = subscribe(mlist, 'Anne') + >>> member <Member: Anne Person <aperson@example.com> on test@example.com as MemberRole.member> + >>> print(member.moderation_action) + None + +Because the list's default member action is set to `defer`, Anne's posting is +not moderated. - >>> member = mlist.members.get_member('aperson@example.com') >>> print(mlist.default_member_action) Action.defer @@ -46,8 +50,9 @@ Because Anne is not moderated, the member moderation rule does not match. False Once the member's moderation action is set to something other than `defer` or -``None``, the rule matches. Also, the message metadata has a few extra pieces -of information for the eventual moderation chain. +``None`` (given the list's current default member moderation action), the rule +matches. Also, the message metadata has a few extra pieces of information for +the eventual moderation chain. >>> from mailman.interfaces.action import Action >>> member.moderation_action = Action.hold @@ -71,20 +76,26 @@ postings are held for moderator approval. nonmember-moderation Bart, who is not a member of the mailing list, sends a message to the list. -:: +He has no explicit nonmember moderation action. >>> from mailman.interfaces.member import MemberRole - >>> subscribe(mlist, 'Bart', MemberRole.nonmember) + >>> nonmember = subscribe(mlist, 'Bart', MemberRole.nonmember) + >>> nonmember <Member: Bart Person <bperson@example.com> on test@example.com as MemberRole.nonmember> + >>> print(nonmember.moderation_action) + None + +The list's default nonmember moderation action is to hold postings by +nonmembers. - >>> nonmember = mlist.nonmembers.get_member('bperson@example.com') >>> print(mlist.default_nonmember_action) Action.hold -When Bart is registered as a nonmember of the list, his moderation action is -set to hold by default. Thus the rule matches and the message metadata again -carries some useful information. +Since Bart is registered as a nonmember of the list, and his moderation action +is set to None, the action falls back to the list's default nonmember +moderation action, which is to hold the post for moderator approval. Thus the +rule matches and the message metadata again carries some useful information. >>> nonmember_msg = message_from_string("""\ ... From: bperson@example.com |
