[Mailman-Users] User Passwords - Mass Subscribe/Mass Change

Drew Tenenholz drew.tenenholz at isid.org
Wed May 30 03:24:55 CEST 2012


All --

So, I found a somewhat useful script out there on the internet, and I'm able to save & run it, but it always generates a random password.  I've made what I think are a couple of simple changes that should allow me to set a specific (unitary) password, but that's not what the script reports, and if I try to unsubscribe, I do get an email reply saying I used the wrong password, so....

Any help in fixing this code?

TIA,
Drew


import sys
import getopt

import paths
from Mailman import Utils
from Mailman.i18n import _


try:
    True, False
except NameError:
    True = 1
    False = 0



def usage(code, msg=''):
    if code:
        fd = sys.stderr
    else:
        fd = sys.stdout
    print >> fd, _(__doc__.replace('%', '%%'))
    if msg:
        print >> fd, msg
    sys.exit(code)



def reset_pw(mlist, *args):
    try:
        opts, args = getopt.getopt(args, 'v', ['verbose'])
    except getopt.error, msg:
        usage(1, msg)

    verbose = False
    for opt, args in opts:
        if opt in ('-v', '--verbose'):
            verbose = True

    listname = mlist.internal_name()
    if verbose:
        print _('Changing passwords for list: %(listname)s')

    for member in mlist.getMembers():

# specify a unitary password below
        newpw = 'ISID'
#

        mlist.setMemberPassword(member, newpw)
        if verbose:
            print _('New password for member %(member)40s: %(newpw)s')

    mlist.Save()



if __name__ == '__main__':
    usage(0)


More information about the Mailman-Users mailing list