diff options
| author | bwarsaw | 2000-03-16 05:19:16 +0000 |
|---|---|---|
| committer | bwarsaw | 2000-03-16 05:19:16 +0000 |
| commit | 0adacb346b528a6f29d576d13936b2a10260db58 (patch) | |
| tree | cad7c4cc028d1531b60713f4646c1f646e276078 /Mailman/versions.py | |
| parent | f90b3a08a6bd939d32bfb1d409d9d800c71daedc (diff) | |
| download | mailman-0adacb346b528a6f29d576d13936b2a10260db58.tar.gz mailman-0adacb346b528a6f29d576d13936b2a10260db58.tar.zst mailman-0adacb346b528a6f29d576d13936b2a10260db58.zip | |
Conversion of Mailman 1.1 pending admin database to 1.2/2.0 external
requests.db database. This should be the last major hurdle for the
new version. Specifically,
NewRequestsDatabase(): This knows about the 1.1 style mlist.requests
dictionary, which served as the pending requests database. It sucks
everything out of this dict and resubmits the requests using the new
APIs. Worst thing that happens its that the timestamps get blown
away. Oh well.
older(): Removed since it's not used anywhere.
Diffstat (limited to '')
| -rw-r--r-- | Mailman/versions.py | 60 |
1 files changed, 48 insertions, 12 deletions
diff --git a/Mailman/versions.py b/Mailman/versions.py index 3a4539349..f5df90bf7 100644 --- a/Mailman/versions.py +++ b/Mailman/versions.py @@ -36,8 +36,10 @@ run again until another version change is detected. import re import string from types import ListType, StringType -import mm_cfg -import Utils + +from Mailman import mm_cfg +from Mailman import Utils +from Mailman import Message @@ -47,6 +49,7 @@ def Update(l, stored_state): UpdateOldVars(l, stored_state) UpdateOldUsers(l) CanonicalizeUserOptions(l) + NewRequestsDatabase(l) @@ -207,13 +210,46 @@ def CanonicalizeUserOptions(l): -def older(version, reference): - """True if version is older than current. - - Different numbering systems imply version is older.""" - if type(version) != type(reference): - return 1 - if version >= reference: - return 0 - else: - return 1 +def NewRequestsDatabase(l): + """With version 1.2, we use a new pending request database schema.""" + r = getattr(l, 'requests', {}) + if not r: + # no old-style requests + return + for k, v in r.items(): + if k == 'post': + # This is a list of tuples with the following format + # + # a sequential request id integer + # a timestamp float + # a message tuple: (author-email-str, message-text-str) + # a reason string + # the subject string + # + # We'll re-submit this as a new HoldMessage request, but we'll + # blow away the original timestamp and request id. This means the + # request will live a little longer than it possibly should have, + # but that's no big deal. + for p in v: + author, text = p[2] + reason = p[3] + msg = Message.OutgoingMessage(text) + l.HoldMessage(msg, reason) + del r[k] + elif k == 'add_member': + # This is a list of tuples with the following format + # + # a sequential request id integer + # a timestamp float + # a digest flag (0 == nodigest, 1 == digest) + # author-email-str + # password + # + # See the note above; the same holds true. + for ign, ign, digest, addr, password in v: + l.HoldSubscription(addr, password, digest) + del r[k] + else: + l.LogMsg('error', + "VERY BAD NEWS. Unknown pending request type `%s' found" + ' for list: %s' % (k, l._internal_name)) |
