Apply 67_update_handle_old_versions.patch
[mspang/vmailman.git] / bin / update
index c36dc27..c1b882a 100755 (executable)
@@ -514,9 +514,11 @@ def update_pending():
     file20 = os.path.join(mm_cfg.DATA_DIR, 'pending_subscriptions.db')
     file214 = os.path.join(mm_cfg.DATA_DIR, 'pending.pck')
     db = None
+    ver = None
     # Try to load the Mailman 2.0 file
     try:
         fp = open(file20)
+        ver = "20"
     except IOError, e:
         if e.errno <> errno.ENOENT: raise
     else:
@@ -528,6 +530,7 @@ def update_pending():
         # Try to load the Mailman 2.1.x where x < 5, file
         try:
             fp = open(file214)
+            ver = "214"
         except IOError, e:
             if e.errno <> errno.ENOENT: raise
         else:
@@ -561,8 +564,12 @@ def update_pending():
             # data[0] is the address being unsubscribed
             addrops_by_address.setdefault(data[0], []).append((key, val))
         elif op == Pending.SUBSCRIPTION:
-            # data[0] is a UserDesc object
-            addr = data[0].address
+            if ver == "20":
+                # data is tuple (emailaddr, password, digest)
+                addr = data[0]
+            else:
+                # data[0] is a UserDesc object
+                addr = data[0].address
             subs_by_address.setdefault(addr, []).append((key, val))
         elif op == Pending.RE_ENABLE:
             # data[0] is the mailing list's internal name