diff options
author | bwarsaw <> | 2003-11-03 13:49:05 +0000 |
---|---|---|
committer | bwarsaw <> | 2003-11-03 13:49:05 +0000 |
commit | e0d1036cdb1c77e435ae2ff271cfa5132df7791f (patch) | |
tree | b109d38fb7cea6faf3e03022e0b21124dc328965 /Mailman/Cgi | |
parent | bd7430a73000694eb7b031388b38715b32ed8f54 (diff) | |
download | mailman2-e0d1036cdb1c77e435ae2ff271cfa5132df7791f.tar.gz mailman2-e0d1036cdb1c77e435ae2ff271cfa5132df7791f.tar.xz mailman2-e0d1036cdb1c77e435ae2ff271cfa5132df7791f.zip |
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.
Diffstat (limited to 'Mailman/Cgi')
-rw-r--r-- | Mailman/Cgi/options.py | 28 |
1 files changed, 24 insertions, 4 deletions
diff --git a/Mailman/Cgi/options.py b/Mailman/Cgi/options.py index 2f9e9afa..b8a589d6 100644 --- a/Mailman/Cgi/options.py +++ b/Mailman/Cgi/options.py @@ -39,6 +39,12 @@ SETLANGUAGE = -1 _ = i18n._ i18n.set_language(mm_cfg.DEFAULT_SERVER_LANGUAGE) +try: + True, False +except NameError: + True = 1 + False = 0 + def main(): @@ -157,8 +163,22 @@ def main(): # 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 @@ address. Upon confirmation, any other mailing list containing the address # 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() |