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

Mark Sapiro mark at msapiro.net
Wed May 30 03:37:44 CEST 2012

Drew Tenenholz wrote:
>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?

Fixing it how? Do you know that it is a withlist script. It should be
saved in Mailman's bin/ directory as bin/reset_pw.py and run via a
command like

 bin/withlist -l -r reset_pw LISTNAME

Is that how you're running it? If so, what happens when you run it?

Also, if you edited out the docstring from the file in addition to from
this email, you will have issues with the 'usage()' function.

>import sys
>import getopt
>import paths
>from Mailman import Utils
>from Mailman.i18n import _
>    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)
>Mailman-Users mailing list Mailman-Users at python.org
>Mailman FAQ: http://wiki.list.org/x/AgA3
>Security Policy: http://wiki.list.org/x/QIA9
>Searchable Archives: http://www.mail-archive.com/mailman-users%40python.org/
>Unsubscribe: http://mail.python.org/mailman/options/mailman-users/mark%40msapiro.net
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