Changing List Owners (and much more) in Mailman

Recently a staff member left the business for an extended holiday and beyond (congratulations). He was however the owner and moderator of almost fifty Mailman mailing lists. This would take "a while" if one had to change the ownerships manually on the Mailman web interface. Strangely, there seemed to no obvious command-line tool in the Mailman /bin directory.

Taking an example from a very similar problem where the user was changing the hosts, I made a tiny modification to the recommended script as follows:

def change_owner(mlist):
    mlist.owner = [x.replace('formerowner@vpac.org', 'newowner@vpac.org') for x in mlist.owner]
    mlist.moderator = [x.replace('formerowner@vpac.org', 'newowner@vpac.org') for x in mlist.moderator]
    mlist.Save()
    mlist.Unlock()

This was be saved in Mailman's bin/ directory with name change_owner.py and run by bin/withlist -l -a -r change_owner. Note no .py extension in the withlist command line.

It is interesting to think how adaptable these few lines are for an enormous variety of related tasks. Essentially, any mailman variable that requires changing across a variety of lists can be done so; it's a site-wide global search and replace for mailman variables - and that's quite nice.

So how many mlist variable are there? Well, obviously you can do through the web interface, which gives some documentation as well. Or you can run

bin/dumpdb /var/lib/mailmanlists/
/config.pck