Bugs item #1298841, was opened at 2005-09-22 10:17 Message generated for change (Tracker Item Submitted) made by Item Submitter You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=100103&aid=1298841&group_id=103
Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: command line scripts Group: 2.1 (stable) Status: Open Resolution: None Priority: 5 Submitted By: adrianwi (adrianwi) Assigned to: Nobody/Anonymous (nobody) Summary: withlist locks with -l and -a switches Initial Comment: The following is from <http://www.mail-archive.com/mailman-users%40python.org/msg34340.html> Thanks to Mark for the reply and explaniation. This probably belongs in both the command line scripts and documentation category. >customchange.py is located at the root installation directory >of Mailman. >It contains: > ># Python function to make custom changes >def customchange(m): > curlist = m.real_name > curlist = curlist.lower() > print 'Current list is: ' + curlist > if curlist.startswith('apples'): > print 'Starts with apples! Current host_name is: ' + m.host_name > print 'Changing hostname now...' > m.host_name = 'lists.newlistname.org' > m.Save() > > >This script is then run with withlist: > >./withlist -a -l -r customchange > > >After preforming this, I noticed that the web interface for lists >are not accessible and that the locks directory contains at >least two lock files for every list. This probably should be considered a bug in withlist or at least a documentation deficiency. The problem is when running withlist with -l and -a switches, only the last list is unlocked by withlist. Thus you need to unlock the lists in your script. In your example you could do this two ways 1) make sure you unlock every list, processed or not. # Python function to make custom changes def customchange(m): curlist = m.real_name curlist = curlist.lower() print 'Current list is: ' + curlist if curlist.startswith('apples'): print 'Starts with apples! Current host_name is: ' + m.host_name print 'Changing hostname now...' m.host_name = 'lists.newlistname.org' m.Save() m.Unlock() 2) run withlist with -a but without -l and only lock the lists you're changing. # Python function to make custom changes def customchange(m): curlist = m.real_name curlist = curlist.lower() print 'Current list is: ' + curlist if curlist.startswith('apples'): m.Lock() print 'Starts with apples! Current host_name is: ' + m.host_name print 'Changing hostname now...' m.host_name = 'lists.newlistname.org' m.Save() m.Unlock() 3) Safer still is like 2) with the addition of try: finally: # Python function to make custom changes def customchange(m): curlist = m.real_name curlist = curlist.lower() print 'Current list is: ' + curlist if curlist.startswith('apples'): try: m.Lock() print 'Starts with apples! Current host_name is: ' + m.host_name print 'Changing hostname now...' m.host_name = 'lists.newlistname.org' m.Save() finally: m.Unlock() -- Mark Sapiro ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=100103&aid=1298841&group_id=103 _______________________________________________ Mailman-coders mailing list [email protected] http://mail.python.org/mailman/listinfo/mailman-coders
