[sysadmin-bin] safely unlock



commit 6322df15eb33da24a52093463561291ee77111a6
Author: Olav Vitters <olav vitters nl>
Date:   Fri Oct 28 00:03:24 2011 +0200

    safely unlock

 mail/mailman-moderated-lists |   12 +++++++-----
 1 files changed, 7 insertions(+), 5 deletions(-)
---
diff --git a/mail/mailman-moderated-lists b/mail/mailman-moderated-lists
index b4c08db..560f6cb 100755
--- a/mail/mailman-moderated-lists
+++ b/mail/mailman-moderated-lists
@@ -57,11 +57,13 @@ for n in mlist_names:
         continue
 
     mlist.Lock()
-    for attr_name, attr_val in change:
-        print "Resetting", attr_name, "for mailing list:", n
-        setattr(mlist, attr_name, attr_val)
-    mlist.Save()
-    mlist.Unlock()
+    try:
+        for attr_name, attr_val in change:
+            print "Resetting", attr_name, "for mailing list:", n
+            setattr(mlist, attr_name, attr_val)
+        mlist.Save()
+    finally:
+        mlist.Unlock()
 
 f = open(PATH_MLIST_NAMES, 'w')
 f.write("\n".join(moderated_lists))



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]