[Mailman-Users] Removing moderation flag via the command line

Mark Sapiro mark at msapiro.net
Tue Dec 23 18:33:58 CET 2008

Joe Auty wrote:
>I'm trying to remove the moderator flag on some users via the command
>line so that these users are allowed to post to lists where the
>moderator flag is set by default. I found this posting from Feb. 2005,
>but this doesn't appear to be working for me:
>My script in the Mailman base directory:
>> # DU mailman Modules
>> # This should live in the base Mailman install directory to be seen by the withlist Mailman binary.
>> from Mailman import mm_cfg
>> from Mailman.Errors import NotAMemberError
>> # Set a member's moderator flag to on or off
>> # e.g. to disable moderation: setMemberModeratedFlag listname, email_address, ''
>> def setMemberModeratedFlag (mlist, addr, mod):
>>     #print "Setting moderator flag to ",mod," for ",addr
>>     mlist.setMemberOption (addr, mm_cfg.Moderate, mod)
>>     mlist.Save()
>My input:
># withlist -l -r du.setMemberModeratedFlag testlist myemailaddress ''
>Importing du...
>Running du.setMemberModeratedFlag()...
>Loading list testlist (locked)
>Unlocking (but not saving) list: testlist

I don't know why this doesn't work. It works for me.

>(I also tried replacing the double quotes with "off").

That will definetly not work. That will pass the string "off" as the
value of mod in the mlist.setMemberOption (addr, mm_cfg.Moderate, mod)
call, and setMemberOption tests the Python truth of this value. Since
"off" is a non-zero length string, it is True so the option will be
set On. The null string is the only argument that can be passed to
this script which has value False.

>This does not
>actually remove the flag for this address - posting to the list by this
>address still gets a bounce back saying that moderator approval is required.
>Any ideas?

See the script at <http://www.msapiro.net/scripts/set_mod.py> which is
more robust and may work better for you.

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