[Mailman-Developers] mod.py: query/set/reset moderation flag

Dan Mick Dan Mick <dmick@utopia.West.Sun.COM>
Wed, 6 Feb 2002 19:28:13 -0800 (PST)


Sometimes the web interface isn't what you're after.  Here's
a bin/withlist plugin:

# mod.py

from Mailman import mm_cfg
import sys

def mod(list):
    for member in list.getMembers():
        if list.getMemberOption(member, mm_cfg.Moderate):
            print member, "is moderated"

def set(list, member, value):
    value = not not (int(value))
    if list.isMember(member):
        list.Lock()
        list.setMemberOption(member, mm_cfg.Moderate, value)
        print "%s's moderated flag set to %d" % (member, value)
        list.Save()
        list.Unlock()
    else:
        print member, "not a member"

Invoke with:

bin/withlist -r mod <list>  to dump moderated membernames
bin/withlist -r mod.set <list> <member> [0|1]  to set moderation status