[Mailman-Users] Changing multiple lists via withlist

Mark Sapiro msapiro at value.net
Thu Dec 8 01:46:22 CET 2005

Robert Haack wrote:

>I have over 120 lists for which I need to make a couple of changes to
>the config files.  I don't really want to do this manually and I have
>very limited Python experience.  I believe from what I've seen that
>withlist is my best option but I could be wrong.  The two things I want
>to change are:
>1) Change the message footer for non digest option.
>2) I also have the need to add/remove email addresses in "List of
>non-member addresses whose postings should be automatically accepted"
>section Privacy Options - Sender Filters.

Both these tasks are amenable to a withlist --all solution IF you want
the resulatant footer to be the same on all 120 lists and if you want
either the same accept_these_nonmembers result or the same additions
and deletions on all 120 lists.

>I looked in the FAQ and searched the archives but I did not see anything
>like what I'm looking for.
>Does anybody have some similar examples that they could share with me or
>perhaps point me to another web site that would help with this?

If you know Python, the examples in withlist --help and in the archives
of this list are probably enough. If you don't know Python, probably
nothing short of a specific solution will do.

Here's something off the top of my head, untested even for syntax
errors and no warranty.

-----------------start of ListMods.py----------------
def new_footer(mlist):
    mlist.msg_footer = """___________________________________
line after underscore line above
next line
last line

def add_accept(mlist, user):
    if user in mlist.accept_these_nonmembers:
        print "%s: %s already in accept_these_nonmembers" % (
               mlist.real_name, user)

def del_accept(mlist, user):
    if user in mlist.accept_these_nonmembers:
       del mlist.accept_these_nonmembers[
        print "%s: %s not in accept_these_nonmembers" % (
               mlist.real_name, user)
-----------------------end of ListMods.py--------------

Save ListMods.py in bin/  Then to set the above msg_footer in all
lists, run

bin/withlist --all --run ListMods.new_footer

to add x at example.com to all list's accept_these_nonmembers, run

bin/withlist --all --run ListMods.add_accept x at example.com

To delete y at example.com from all list's accept_these_nonmembers, run

bin/withlist --all --run ListMods.del_accept y at example.com

You could also define a new_accept(mlist) function to simply assign a
list of addresses to mlist.accept_these_nonmembers analagous to the
new_footer function except with a list of addresses instead of a
multiline string.

Mark Sapiro <msapiro at value.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