[Mailman-Users] Automate Moderator Functions

Dennis Putnam dap1 at bellsouth.net
Wed Oct 3 01:06:32 CEST 2012


I am getting back to this and I have a question about maintenance. What
is the correct way to modify this so that it will not get destroyed by
updates?

Also does this same procedure apply to other automatic rejections such
as implicit destination?

Thanks.

On 9/24/2012 8:43 PM, Mark Sapiro wrote:
> Dennis Putnam wrote:
>> The same might be true for
>> exceeding the size limit.
>
> To automatically reject or discard messages that exceed the list's size
> limit, find the section of the Mailman/Handlers/Hold.py that ends with
> the lines
>
>
>         if bodylen/1024.0 > mlist.max_message_size:
>             hold_for_approval(mlist, msg, msgdata,
>                               MessageTooBig(bodylen,
> mlist.max_message_size))
>             # no return
>
> (there is one wrapped line in the above) and replace
>
>             hold_for_approval(mlist, msg, msgdata,
>                               MessageTooBig(bodylen,
> mlist.max_message_size))
>
> with
>
>             rej = MessageTooBig(bodylen, mlist.max_message_size))
>             raise Errors.RejectMessage, rej.reason_notice
>
> to reject the message or with
>
>             raise Errors.DiscardMessage
>
> to discard the message. Note that this will not honor the list's
> forward_auto_discards setting. to do that you would need to put
>
> from Mailman.Handlers.Moderate import do_discard
>
> with the other imports near the beginning of the
> Mailman.Handlers.hold.py module and then replace the lines with
>
>             do_discard(mlist, msg)
>
> If you are actually going to do any of the above, I suggest you also
> put the following in mm_cfg.py for the stated reason
>
> #
> # Put MimeDel ahead of Hold so "too big" is based on content filtered
> # message.
> #
> GLOBAL_PIPELINE.remove('MimeDel')
> GLOBAL_PIPELINE.insert(GLOBAL_PIPELINE.index('Hold'), 'MimeDel')
>
>
> Instead of modifying Hold.py, you could make a custom handler (see
> <http://wiki.list.org/x/l4A9>) to deal with oversized messages and put
> it ahead of Hold in the pipeline or possibly just replace Hold.py with
> a custom version.
>


-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 257 bytes
Desc: OpenPGP digital signature
URL: <http://mail.python.org/pipermail/mailman-users/attachments/20121002/e15994e8/attachment.pgp>


More information about the Mailman-Users mailing list