[Mailman-Users] config_list does not finish

Mark Sapiro msapiro at value.net
Mon Mar 26 01:22:34 CEST 2007


Michael McAndrew wrote:
>
>Thanks a lot,
>
>The triple string quotes didn't appear in the config file - they were in the
>email only to show the start and end of the quoted config file: confusing in
>retrospect.


Yes, I was confused.


>When I looked this morning, the lists were working again,and (thanks to the
>reply) I now know why this was - The lists were locked and hadn't been
>unlocked afterwards.  One problem for me was that I didn't know if lists are
>initially locked or unlocked, and consequently didn't know whether to leave
>them locked or unlocked at the end.  I've put a fuller explanation below in
>case it helps someone in a similar position to me.
>
>I have a script I run every half hour that adjusts moderation bits on some
>lists.  I was running the script with the -l (lock) option but not calling
>the method m.Save() before it finished (the m.Save() method unlocks the
>list,I presume) which meant the list wasn't automatically unlocked.  I
>presume mailman noticed and was able to deal with this most of the time, but
>not always, which is why it hung sometimes.


No. The Save() method only saves the updated list. It doesn't unlock
it. A list is unlocked by calling the Unlock() method.

If you are only processing one list with withlist, withlist will unlock
the list when the script exits, but if you are processing multiple
lists with something like

  /path/to/bin/withlist -l -a -r callable

withlist will only unlock the last list processed and you will be left
with locked lists unless you specifically unlock them within the
callable function. If you specify both -l and -a to withlist, you must
explicitly Unlock() the list whether or not you Save() it first or you
will be left with locked lists.

An appropriate callable.py for this scenario contains

def callable(mlist, ...):
    if not mlist.Locked():
        mlist.Lock()

    (process here)

    mlist.Save()
    mlist.Unlock()

This works whether or not the -l option is given to withlist. It also
works if callable exits because of an exception in its process because
withlist sets sys.exitfunc to its own function which unlocks the list
if locked.


>Actually, I feel like this was the last hurdle in a long process of
>integrating mailman with another open source php based CMS that I a have
>also customised a bit.  It's been a steep and mostly enjoyable learning
>curve, and though it might be standard for someone with a history in open
>source, for me it was pretty great to be able to do all this, and the
>support was really great - Cool - thanks a lot,
>
>Michael

-- 
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