[Mailman-Users] Radio button options for message size

Mark Sapiro msapiro at value.net
Fri Jun 30 01:44:20 CEST 2006


Rob Jackson wrote:

>I don't want to give the admin the choice to put in any number they want,
>instead I want options, like 10k, 20k, 40k, 80k, and so forth.  Right now,
>the way mailman is set up, each radio button will represent a placement.  So
>right now, 10k will be 0, 20k will be 1, 40k will be 2, 80k will be 3 and so
>forth.  Is there a way I can change this?


Perhaps the easiest way to do your exact example is to just let the
radio buttons for 10k, 20k, 40k, 80k set values of 0, 1, 2, 3 and
change Mailman/Handlers/Hold.py by replacing

    if mlist.max_message_size > 0:

with

    if True:

and replacing

        if bodylen/1024.0 > mlist.max_message_size:

with

        if bodylen/1024.0 > 10.0 * mlist.max_message_size ** 2:

Obviously, there are other ways to code the same logic. If your sizes
don't follow a simple geometric progression, you might need a more
complicated calculation or a table lookup.

But here's another idea. Instead of radio buttons, why not just set a
minimum and maximum for this setting and enforce it in
Mailman/Cgi/admin.py or the CheckValues() method in
Mailman/MailList.py.

-- 
Mark Sapiro <msapiro at value.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