Add Debian directory
[mspang/vmailman.git] / debian / patches / 67_update_handle_old_versions.patch
1 Patch: 67_update_handle_old_versions.patch
2 Author: Bastian Kleineidam <calvin@debian.org>
3 Handle the case of upgrading from Mailman 2.0 where we have
4 pending subscriptions.
5 Index: bin/update
6 ===================================================================
7 --- bin/update.orig     2006-08-15 15:14:50.000000000 +0800
8 +++ bin/update  2006-08-15 15:14:52.000000000 +0800
9 @@ -514,9 +514,11 @@
10      file20 = os.path.join(mm_cfg.DATA_DIR, 'pending_subscriptions.db')
11      file214 = os.path.join(mm_cfg.DATA_DIR, 'pending.pck')
12      db = None
13 +    ver = None
14      # Try to load the Mailman 2.0 file
15      try:
16          fp = open(file20)
17 +        ver = "20"
18      except IOError, e:
19          if e.errno <> errno.ENOENT: raise
20      else:
21 @@ -528,6 +530,7 @@
22          # Try to load the Mailman 2.1.x where x < 5, file
23          try:
24              fp = open(file214)
25 +            ver = "214"
26          except IOError, e:
27              if e.errno <> errno.ENOENT: raise
28          else:
29 @@ -561,8 +564,12 @@
30              # data[0] is the address being unsubscribed
31              addrops_by_address.setdefault(data[0], []).append((key, val))
32          elif op == Pending.SUBSCRIPTION:
33 -            # data[0] is a UserDesc object
34 -            addr = data[0].address
35 +            if ver == "20":
36 +                # data is tuple (emailaddr, password, digest)
37 +                addr = data[0]
38 +            else:
39 +                # data[0] is a UserDesc object
40 +                addr = data[0].address
41              subs_by_address.setdefault(addr, []).append((key, val))
42          elif op == Pending.RE_ENABLE:
43              # data[0] is the mailing list's internal name