summaryrefslogtreecommitdiff
path: root/Mailman
diff options
context:
space:
mode:
authorbwarsaw2001-10-15 21:54:41 +0000
committerbwarsaw2001-10-15 21:54:41 +0000
commit04713934dfb9421502b77c093e4de626ad3444bc (patch)
treeb2263fda7f26c453bed5b5dc59d5b816cbeb6892 /Mailman
parent03a019366f85e49410b2c49d86f9a0d770cc10b4 (diff)
downloadmailman-04713934dfb9421502b77c093e4de626ad3444bc.tar.gz
mailman-04713934dfb9421502b77c093e4de626ad3444bc.tar.zst
mailman-04713934dfb9421502b77c093e4de626ad3444bc.zip
UpdateOldVars(): Handle the migration of the old privacy variables to
the new ones. I think this is as close as we can get: - add default_member_moderation, accept_these_nonmembers, hold_these_nonmembers, reject_these_nonmembers, discard_these_nonmembers, forward_auto_discards, generic_nonmember_action - moderated -> generic_nonmember_action, also if we were moderating this list, then the generic_nonmember_action should be to hold the message, otherwise it should be to accept it. - for each address in forbidden_posters, if the address is a member, set their moderate flag to true, otherwise add them to hold_these_nonmembers. - posters (fun! not.) and member_posting_only: if member_posting_only == yes and there are posters, then they are members and non-members we automatically accept. So for members, turn off their moderation bit, and for non-members we add them to accept_these_nonmembers. BUT! if member_post_only == no, posters is the list of addresses we only accept, with all others being held. So, first turn the moderation bit on for all members, then for addresses in posters which are members, turn their moderation bit off, and for addresses which are nonmembers, add them to accept_these_nonmembers. Phew!
Diffstat (limited to 'Mailman')
-rw-r--r--Mailman/versions.py69
1 files changed, 69 insertions, 0 deletions
diff --git a/Mailman/versions.py b/Mailman/versions.py
index 5d85eb9a5..ba3ddebdb 100644
--- a/Mailman/versions.py
+++ b/Mailman/versions.py
@@ -92,6 +92,75 @@ def UpdateOldVars(l, stored_state):
l.respond_to_post_requests = not oldval
del l.dont_respond_to_post_requests
+ # Migrate to 2.1b3, baw 13-Oct-2001
+ # Basic defaults for new variables
+ if not hasattr(l, 'default_member_moderation'):
+ l.default_member_moderation = mm_cfg.DEFAULT_DEFAULT_MEMBER_MODERATION
+ if not hasattr(l, 'accept_these_nonmembers'):
+ l.accept_these_nonmembers = []
+ if not hasattr(l, 'hold_these_nonmembers'):
+ l.hold_these_nonmembers = []
+ if not hasattr(l, 'reject_these_nonmembers'):
+ l.reject_these_nonmembers = []
+ if not hasattr(l, 'discard_these_nonmembers'):
+ l.discard_these_nonmembers = []
+ if not hasattr(l, 'forward_auto_discards'):
+ l.forward_auto_discards = mm_cfg.DEFAULT_FORWARD_AUTO_DISCARDS
+ if not hasattr(l, 'generic_nonmember_action'):
+ l.generic_nonmember_action = mm_cfg.DEFAULT_GENERIC_NONMEMBER_ACTION
+ # Now convert what we can...
+ if hasattr(l, 'moderated'):
+ # The closest we can get to the semantics of this variable is to set
+ # the default member moderation flag, and to set the generic nonmember
+ # action.
+ oldval = getattr(l, 'moderated')
+ # Flag values have the same semantic
+ l.default_member_moderation = oldval
+ # If we were moderating, then hold nonmember postings, otherwise
+ # accept them.
+ if oldval:
+ l.generic_nonmember_action = 1
+ else:
+ l.generic_nonmember_action = 0
+ del l.moderated
+ if hasattr(l, 'forbidden_posters'):
+ # For each of the posters on this list, if they are members, toggle on
+ # their moderation flag. If they are not members, then add them to
+ # hold_these_nonmembers.
+ forbiddens = l.forbidden_posters
+ for addr in forbiddens:
+ if l.isMember(addr):
+ l.setMemberOption(addr, mm_cfg.Moderate, 1)
+ else:
+ l.hold_these_nonmembers.append(addr)
+ del l.forbidden_posters
+ if hasattr(l, 'posters'):
+ # This is a fun one. :( The semantics of this and member_posting_only
+ # is way too confusing, which is why we're getting rid of them here.
+ # If there are posters and member_posting_only == yes, then posters
+ # are members or non-members that we will automatically accept. If
+ # there are posters, but member_posting_only == no, then we will
+ # automatically accept any members or non-members, but all other
+ # member postings will be held for approval. I think.
+ posters = l.posters
+ membersonly = l.member_posting_only
+ if posters:
+ if not membersonly:
+ # Turn on the moderation bit of all the existing members, and
+ # the default moderation bit
+ l.default_member_moderation = 1
+ for addr in l.getMembers():
+ l.setMemberOption(addr, mm_cfg.Moderate, 1)
+ # Now turn off the moderation bit for all poster members, or add
+ # non-members to auto-accept.
+ for addr in posters:
+ if l.isMember(addr):
+ l.setMemberOption(addr, mm_cfg.Moderate, 0)
+ else:
+ l.accept_these_nonmembers.append(addr)
+ del l.posters
+ del l.member_posting_only
+
# Migrate to 1.0b6, klm 10/22/1998:
PreferStored('reminders_to_admins', 'umbrella_list',
mm_cfg.DEFAULT_UMBRELLA_LIST)