[Mailman-Users] Finding disabled users

Dan Mick Dan.Mick at West.Sun.COM
Wed Jan 19 04:31:39 CET 2000


No, not users who have some sort of physical problem: I mean those
who the list (probably) has set the "disabled" option for.  I
asked for a hack to find them; no one responded, so I got dangerous
and hacked up withlist to make a command.  Here it is.  I use
it with a shell script to send them all a message reminding
them they're disabled (since, if they were disabled by having a full
inbox, they may never have seen the message).

#!/usr/bin/python

"""List disabled members of a mailing list

bin/list_disabled_members listname

    --help
    -h
        Print this message and exit

"""

import sys
import getopt
import string
import paths
from Mailman.MailList import MailList

m = None



def usage(msg='', code=1):
    print __doc__ % globals()
    if msg:
        print msg
    sys.exit(code)




def main():
    global m
    try:
        opts, args = getopt.getopt(sys.argv[1:], 'h',
                                   ['help'])
    except getopt.error, m:
        usage(m)

    if len(args) <> 1:
        usage('No list name supplied.')

    listname = args[0]
    lock = 0

    for opt, arg in opts:
        if opt in ('-h', '--help'):
            usage(code=0)

    # first try to open mailing list

    m = MailList(listname, lock=lock)

    for n in m.user_options.keys():    
        if m.user_options[n] & 1: 
            print n
    exit

main()





More information about the Mailman-Users mailing list