Update of /cvsroot/mailman/mailman/Mailman/Cgi
In directory sc8-pr-cvs1:/tmp/cvs-serv4668

Modified Files:
      Tag: Release_2_1-maint
        options.py 
Log Message:
main(): Fix for bug #832748, where unsubscribe_policy was being
ignored for the unsub button on the member login page.  Report and
original patch by Pasi Sjoholm, modify by Barry.

Forward port candidate.


Index: options.py
===================================================================
RCS file: /cvsroot/mailman/mailman/Mailman/Cgi/options.py,v
retrieving revision 2.40.2.2
retrieving revision 2.40.2.3
diff -u -d -r2.40.2.2 -r2.40.2.3
--- options.py  8 Feb 2003 07:13:50 -0000       2.40.2.2
+++ options.py  3 Nov 2003 13:49:05 -0000       2.40.2.3
@@ -39,6 +39,12 @@
 _ = i18n._
 i18n.set_language(mm_cfg.DEFAULT_SERVER_LANGUAGE)
 
+try:
+    True, False
+except NameError:
+    True = 1
+    False = 0
+
 
 
 def main():
@@ -157,8 +163,22 @@
         # 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 unsubs require admin approval, then this request has to be
+            # held.  Otherwise, send a confirmation.
+            if mlist.unsubscribe_policy:
+                try:
+                    mlist.Lock()
+                    mlist.HoldUnsubscription(user)
+                    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:
@@ -416,13 +436,13 @@
         # list admin?) is informed of the removal.
         signal.signal(signal.SIGTERM, sigterm_handler)
         mlist.Lock()
-        needapproval = 0
+        needapproval = False
         try:
             try:
                 mlist.DeleteMember(
                     user, 'via the member options page', userack=1)
             except Errors.MMNeedApproval:
-                needapproval = 1
+                needapproval = True
             mlist.Save()
         finally:
             mlist.Unlock()



_______________________________________________
Mailman-checkins mailing list
[EMAIL PROTECTED]
http://mail.python.org/mailman/listinfo/mailman-checkins

Reply via email to