Hello. I'm running mailman 2.1.11 and i wrote a script to change a user's password, but it doesn't change anything and i can't seem to find the problem. My other "withlist" scripts work fine.
I'm using: mlist.setMemberPassword(member, password) and then mlist.Save() called using "withlist -l -r" I have attached my script. Thanks in advance. Marc Juul
#! /usr/bin/python # """ This script is intended to be run as a bin/withlist script, i.e. % bin/withlist -l -r set_member_password listname --email member_email --password password """ import sys import getopt import paths from Mailman import Utils from Mailman.i18n import _ try: True, False except NameError: True = 1 False = 0 ^L 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) ^L def set_member_password(mlist, *args): try: opts, args = getopt.getopt(args, '', ['email=', 'password=']) except getopt.error, msg: usage(1, msg) email = False password = False for opt, arg in opts: if opt == '--email': email = arg elif opt == '--password': password = arg if (not email) or (not password): print "Error: missing email address and/or password" return False listname = mlist.internal_name() print _('Setting password for email %(email)s for list: %(listname)s') found = False for member in mlist.getMembers(): if mlist.getMemberKey(member) == email: mlist.setMemberPassword(member, password) found = True if not found: print "Error: email not subscribed to list" return False print "Success!" mlist.Save() return True ^L if __name__ == '__main__': usage(0)
_______________________________________________ Mailman-Developers mailing list Mailman-Developers@python.org http://mail.python.org/mailman/listinfo/mailman-developers Mailman FAQ: http://wiki.list.org/x/AgA3 Searchable Archives: http://www.mail-archive.com/mailman-developers%40python.org/ Unsubscribe: http://mail.python.org/mailman/options/mailman-developers/archive%40jab.org Security Policy: http://wiki.list.org/x/QIA9