[Mailman-Users] Script Alternative to Radio Buttons?
Jon Carnes
jonc at nc.rr.com
Mon Aug 11 20:26:21 CEST 2003
On Mon, 2003-08-11 at 13:56, Jordan Hayes wrote:
> > We need a command line script alternative to the web
> > page radio buttons, and we are willing to pay for it!
>
> Here's what I did: in Mailman/Cgi/admindb.py, there's some code that
> looks like this:
>
> buttons.AddRow(map(lambda x, s=' '*5: s+x+s,
> ('Defer', 'Approve', 'Reject', 'Discard')))
> buttons.AddRow([Center(RadioButton(id, mm_cfg.DEFER, 1)),
> Center(RadioButton(id, mm_cfg.APPROVE, 0)),
> Center(RadioButton(id, mm_cfg.REJECT, 0)),
> Center(RadioButton(id, mm_cfg.DISCARD, 0)),
> ])
>
>
> Change the DEFER default to '0' from '1' and change DISCARD from '0' to
> '1' and then when you visit the web page, the default action selected is
> to DISCARD the pending message; after a quick scan to look for 'legit'
> messages, you can drop them all in one click.
>
> You're welcome; that'll be $1.5M.
>
> :-)
>
> /jordan
Well you have got to be using Mailman version 2.0... In which case,
Jordan solution is ideal for you!
If you don't want to re-install, then you can use the work-around that
is in the FAQ.
http://www.python.org/cgi-bin/faqw-mm.py?req=show&file=faq01.012.htp
Basically, you store a copy of the empty request.db file, then you can
delete the messages manually at anytime and replace the old request.db
with the empty one.
rm ~mailman/data/heldmsg-<list-name>-* 2> /dev/null
cp ~mailman/lists/<list-name>/orig.request.db ~mailman/lists/<list-name>/request.db
If you want, you could box it in a script like so:
#! /bin/bash
#
# Mailman 2.0 work around to manually delete held messages
# Note: go through the web interface and scan first (if you like)
# then run this script for the list.
#
# Note: orig.request.db is a copy of an empty request.db database
# that has been copied to ~mailman/data/orig.request.db
#
# Input: The name of an existing list
#
If [ "xxx" == "xxx$1" ]; then
echo Please input the name of a Mailman List
exit 0
fi
#
if [ ! -d ~mailman/lists/$1 ]; then
echo Invalid list name (use all lower case)
exit 0
fi
#
rm ~mailman/data/heldmsg-$1-* 2> /dev/null
cp ~mailman/data/orig.request.db ~mailman/lists/$1/request.db
That should do it for you!
Enjoy - Jon Carnes
More information about the Mailman-Users
mailing list