[Mailman-Developers] Mailman Size Issues
Jim Tittsler
jwt at onjapan.net
Fri May 7 03:45:16 EDT 2004
On May 6, 2004, at 03:34, Kory Wheatley wrote:
> All get to my point, is there a way that if a moderator tries to
> approve a message that is over 1 meg, that maybe some custom python
> code could be developed to pop up a message and say "Only messages
> below 1 meg can be approved" and have the message discarded, or tell
> the user the only option they have is to discard the message.
If the administrator isn't allowed to do anything but discard the
message, wouldn't it be better to just discard (or reject with notice
to the sender) at the time that the message is received rather than
holding it for discard/reject? There are a couple of ways you could do
that.
1. The quick one is modify Mailman/Handlers/Hold.py so that instead of
doing hold_for_approval() you raised Errors.RejectMessage (or
Errors.DiscardMessage) if the message is too big.
--- Hold.py-2.1.4 2003-12-27 07:55:45.000000000 +0900
+++ Hold.py 2004-05-07 16:35:05.000000000 +0900
@@ -177,8 +177,12 @@
for line in email.Iterators.body_line_iterator(msg):
bodylen += len(line)
if bodylen/1024.0 > mlist.max_message_size:
- hold_for_approval(mlist, msg, msgdata,
- MessageTooBig(bodylen,
mlist.max_message_size))
+ raise Errors.RejectMessage, Utils.wrap('''Your message
+exceeds the maximum size allowed for mailing list messages and has
+not been distributed.
+
+For more information on mailing list policy, visit
+http://institution.edu/mail/rules.html or contact
admin at institution.edu''')
# no return
The disadvantage is that you have to remember to make this change each
time you upgrade Mailman.
2. A cleaner way is to add a custom site handler early in the message
pipeline that checks the message size (steal the code from Hold.py :-)
and raises the appropriate error. Add it to your GLOBAL_PIPELINE in
your mm_cfg.py. Good for other site-specific hacks.
But I suppose you could modify Mailman/Cgi/admindb.py to do what you
ask. Don't create the button for "Accept" (or allow the accept
response so nobody gets tricky) for large messages. You would want to
unroll the loop so that the "Reject"/"Discard" buttons are available
for each message rather than for each sender.
--
Jim Tittsler http://www.OnJapan.net/ GPG: 0x01159DB6
Python Starship http://Starship.Python.net/
Ringo MUG Tokyo http://www.ringo.net/rss.html
More information about the Mailman-Developers
mailing list