[Mailman-Users] newsgroup->mailman moderation

Mark Sapiro mark at msapiro.net
Sun Jul 12 18:42:00 CEST 2015


On 7/12/15 8:05 AM, Danil Smirnov wrote:
> Hi Mark!
> 
> I've found your posting advising how to set all posts from Usenet
> group to moderation:
> 
> https://mail.python.org/pipermail/mailman-users/2013-June/075346.html


The change suggested in that post was applied to the distributed code as
of Mailman 2.1.17. See <https://bugs.launchpad.net/mailman/+bug/1252575>.


> When look into Moderate.py I've found another code than mentioned in the post:
> 
> ---
>     # Okay, so the sender wasn't specified explicitly by any of the non-member
>     # moderation configuration variables.  Handle by way of generic non-member
>     # action.
>     assert 0 <= mlist.generic_nonmember_action <= 4
>     if mlist.generic_nonmember_action == 0 or msgdata.get('fromusenet'):
>         # Accept
>         return
>     elif mlist.generic_nonmember_action == 1:
>         Hold.hold_for_approval(mlist, msg, msgdata, Hold.NonMemberPost)
>     elif mlist.generic_nonmember_action == 2:
>         do_reject(mlist)
>     elif mlist.generic_nonmember_action == 3:
>         do_discard(mlist, msg)
> ---
> 
> Is it correct to change the code in this way?
> 
> ---
>     # Okay, so the sender wasn't specified explicitly by any of the non-member
>     # moderation configuration variables.  Handle by way of generic non-member
>     # action.
>     assert 0 <= mlist.generic_nonmember_action <= 4
>     if mlist.generic_nonmember_action == 0:
>         # Accept
>         return
>     elif mlist.generic_nonmember_action == 1 or msgdata.get('fromusenet'):
>         Hold.hold_for_approval(mlist, msg, msgdata, Hold.NonMemberPost)
>     elif mlist.generic_nonmember_action == 2:
>         do_reject(mlist)
>     elif mlist.generic_nonmember_action == 3:
>         do_discard(mlist, msg)
> ---


The change you suggest will 'hold' all non-member posts from usenet as
long as generic_nonmember_action is other than accept and the poster's
address is not in one of the *_these_nonmember filters.

If that's what you want, then the change looks correct.

On the other hand, you could just remove the fromusenet test and apply
generic_nonmember_action to all posts whether or not from Usenet. I.e.,
just change

    if mlist.generic_nonmember_action == 0 or msgdata.get('fromusenet'):

to

    if mlist.generic_nonmember_action == 0:


The difference is with your change if generic_nonmember_action is Reject
or Discard, posts from Usenet will still be held and not rejected or
discarded, but just removing the fromusenet test will allow
generic_nonmember_action to apply to all posts.

-- 
Mark Sapiro <mark at msapiro.net>        The highway is for gamblers,
San Francisco Bay Area, California    better use your sense - B. Dylan


More information about the Mailman-Users mailing list