------------------------------------------------------------
revno: 1049
committer: Mark Sapiro <[EMAIL PROTECTED]>
branch nick: 2.1
timestamp: Sat 2008-02-23 13:16:35 -0800
message:
  MailList.py - Corrected some long standing incomplete logic in the
                ChangeMemberAddress() and ApprovedChangeMemberAddress()
                methods having to do with case-only changes and
                confirmations of changes already done another way.
  
  confirm.py  - Caught a MMAlreadyAMember exception that can occur rarely
                with address changes.  This adds a new i18n string, but
                it's rare enough that I'm not concerned about the translations.
modified:
  Mailman/Cgi/confirm.py
  Mailman/MailList.py

=== modified file 'Mailman/Cgi/confirm.py'
--- a/Mailman/Cgi/confirm.py    2005-12-30 18:50:08 +0000
+++ b/Mailman/Cgi/confirm.py    2008-02-23 21:16:35 +0000
@@ -1,4 +1,4 @@
-# Copyright (C) 2001-2005 by the Free Software Foundation, Inc.
+# Copyright (C) 2001-2008 by the Free Software Foundation, Inc.
 #
 # This program is free software; you can redistribute it and/or
 # modify it under the terms of the GNU General Public License
@@ -529,6 +529,12 @@
             doc.addError(_("""%(newaddr)s is banned from subscribing to the
             %(realname)s list.  If you think this restriction is erroneous,
             please contact the list owners at %(owneraddr)s."""))
+        except Errors.MMAlreadyAMember:
+            realname = mlist.real_name
+            bad_confirmation(doc, _("""%(newaddr)s is already a member of
+            the %(realname)s list.  It is possible that you are attempting
+            to confirm a request for an address that has already been
+            subscribed."""))
         else:
             # The response
             listname = mlist.real_name

=== modified file 'Mailman/MailList.py'
--- a/Mailman/MailList.py       2007-11-26 01:32:26 +0000
+++ b/Mailman/MailList.py       2008-02-23 21:16:35 +0000
@@ -1,4 +1,4 @@
-# Copyright (C) 1998-2007 by the Free Software Foundation, Inc.
+# Copyright (C) 1998-2008 by the Free Software Foundation, Inc.
 #
 # This program is free software; you can redistribute it and/or
 # modify it under the terms of the GNU General Public License
@@ -1065,9 +1065,10 @@
         newaddr = Utils.LCDomain(newaddr)
         Utils.ValidateEmail(newaddr)
         # Raise an exception if this email address is already a member of the
-        # list, but only if the new address is the same case-wise as the old
+        # list, but only if the new address not a case change of the old
         # address and we're not doing a global change.
-        if not globally and newaddr == oldaddr and self.isMember(newaddr):
+        if not globally and not (newaddr <> oldaddr and
+              newaddr.lower() == oldaddr.lower()) and self.isMember(newaddr):
             raise Errors.MMAlreadyAMember
         if newaddr == self.GetListEmail().lower():
             raise Errors.MMBadEmailError
@@ -1123,9 +1124,16 @@
             raise Errors.MembershipIsBanned, pattern
         # It's possible they were a member of this list, but choose to change
         # their membership globally.  In that case, we simply remove the old
-        # address.
-        if self.getMemberCPAddress(oldaddr) == newaddr:
-            self.removeMember(oldaddr)
+        # address.  This gets tricky with case changes.  We can't just remove
+        # the old address if it differs from the new only by case, because
+        # that removes the new, so the condition is if the new address is the
+        # CP address of a member, then if the old address yields a different
+        # CP address, we can simply remove the old address, otherwise we can
+        # do nothing.
+        if self.isMember(newaddr) and (self.getMemberCPAddress(newaddr) ==
+                newaddr):
+            if self.getMemberCPAddress(oldaddr) <> newaddr:
+                self.removeMember(oldaddr)
         else:
             self.changeMemberAddress(oldaddr, newaddr)
         # If globally is true, then we also include every list for which
@@ -1147,8 +1155,10 @@
             mlist.Lock()
             try:
                 # Same logic as above, re newaddr is already a member
-                if mlist.getMemberCPAddress(oldaddr) == newaddr:
-                    mlist.removeMember(oldaddr)
+                if mlist.isMember(newaddr) and (
+                        mlist.getMemberCPAddress(newaddr) == newaddr):
+                    if mlist.getMemberCPAddress(oldaddr) <> newaddr:
+                        mlist.removeMember(oldaddr)
                 else:
                     mlist.changeMemberAddress(oldaddr, newaddr)
                 mlist.Save()



--
Stable, maintained release series
https://code.launchpad.net/~mailman-coders/mailman/2.1

You are receiving this branch notification because you are subscribed to it.
_______________________________________________
Mailman-checkins mailing list
[email protected]
Unsubscribe: 
http://mail.python.org/mailman/options/mailman-checkins/archive%40jab.org

Reply via email to