[Mailman-Developers] Re: [Mailman-Users] unsubscribe_policy problem? (fixed, includes a patch)

Pasi Sjoholm ptsjohol at cc.jyu.fi
Thu Oct 30 05:11:26 EST 2003


Hello again,

anyone didn't reply to me so I fixed this by myself, here is the patch:

--- Mailman/Cgi/options.py~	Thu Oct 30 12:02:41 2003
+++ Mailman/Cgi/options.py	Thu Oct 30 11:44:55 2003
@@ -156,9 +156,22 @@ def main():
     if cgidata.has_key('login-unsub'):
         # Because they can't supply a password for unsubscribing, we'll need
         # to do the confirmation dance.
+
         if mlist.isMember(user):
-            mlist.ConfirmUnsubscription(user, userlang)
-            doc.addError(_('The confirmation email has been sent.'), tag='')
+            # If we're doing admin-approved unsubs, don't worry about the password
+            if mlist.unsubscribe_policy:
+                try: 
+                    mlist.Lock()
+                    try:
+                        mlist.DeleteMember(user, 'via the listinfo page', userack=1)
+                    except Errors.MMNeedApproval:
+                        doc.addError(_('Your unsubscription request has been forwarded to the list administrator for approval.'), tag='')
+                    mlist.Save()
+                finally:
+                    mlist.Unlock()
+            else:
+                mlist.ConfirmUnsubscription(user, userlang)
+                doc.addError(_('The confirmation email has been sent.'), tag='')
         else:
             # Not a member
             if mlist.private_roster == 0:



On Thu, 30 Oct 2003, Pasi Sjoholm wrote:

> This is possible when user is not logged in but when logged there will be 
> a request to unsubscribe user "x" for list admin. So.. it's a bug =) I 
> also tested it on 2.2.3.
> 
> --
> Pasi Sjöholm
> 
> 
> On Thu, 30 Oct 2003, Pasi Sjoholm wrote:
> 
> > Hello,
> > 
> > I set up a mailman today and now I have a little problem. I have this 
> > corporate mailing list and I have set unsubscribe_policy to yes for that 
> > list but still users can unsubscribe via web gui after they have clicked 
> > the unsubscribe and confirmed that they really want to unsubscribe via 
> > email.
> > 
> > I'm using Mailman 2.1.2... is this a bug or what?
> > 
> > --
> > Pasi Sjöholm
-------------- next part --------------
--- Mailman/Cgi/options.py~	Thu Oct 30 12:02:41 2003
+++ Mailman/Cgi/options.py	Thu Oct 30 11:44:55 2003
@@ -156,9 +156,22 @@ def main():
     if cgidata.has_key('login-unsub'):
         # Because they can't supply a password for unsubscribing, we'll need
         # to do the confirmation dance.
+
         if mlist.isMember(user):
-            mlist.ConfirmUnsubscription(user, userlang)
-            doc.addError(_('The confirmation email has been sent.'), tag='')
+            # If we're doing admin-approved unsubs, don't worry about the password
+            if mlist.unsubscribe_policy:
+                try: 
+                    mlist.Lock()
+                    try:
+                        mlist.DeleteMember(user, 'via the listinfo page', userack=1)
+                    except Errors.MMNeedApproval:
+                        doc.addError(_('Your unsubscription request has been forwarded to the list administrator for approval.'), tag='')
+                    mlist.Save()
+                finally:
+                    mlist.Unlock()
+            else:
+                mlist.ConfirmUnsubscription(user, userlang)
+                doc.addError(_('The confirmation email has been sent.'), tag='')
         else:
             # Not a member
             if mlist.private_roster == 0:


More information about the Mailman-Developers mailing list