diff options
Diffstat (limited to 'Mailman/Cgi/options.py')
| -rw-r--r-- | Mailman/Cgi/options.py | 37 |
1 files changed, 30 insertions, 7 deletions
diff --git a/Mailman/Cgi/options.py b/Mailman/Cgi/options.py index 09f629874..0ebd76329 100644 --- a/Mailman/Cgi/options.py +++ b/Mailman/Cgi/options.py @@ -1,4 +1,4 @@ -# Copyright (C) 1998-2003 by the Free Software Foundation, Inc. +# Copyright (C) 1998-2004 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 @@ -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,23 @@ 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='') + # We must acquire the list lock in order to pend a request. + try: + mlist.Lock() + # If unsubs require admin approval, then this request has to + # be held. Otherwise, send a confirmation. + if mlist.unsubscribe_policy: + mlist.HoldUnsubscription(user) + doc.addError(_("""Your unsubscription request has been + forwarded to the list administrator for approval."""), + tag='') + else: + mlist.ConfirmUnsubscription(user, userlang) + doc.addError(_('The confirmation email has been sent.'), + tag='') + mlist.Save() + finally: + mlist.Unlock() else: # Not a member if mlist.private_roster == 0: @@ -199,7 +220,6 @@ def main(): # Authenticate, possibly using the password supplied in the login page password = cgidata.getvalue('password', '').strip() - if not mlist.WebAuthenticate((mm_cfg.AuthUser, mm_cfg.AuthListAdmin, mm_cfg.AuthSiteAdmin), @@ -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() @@ -609,7 +629,10 @@ address. Upon confirmation, any other mailing list containing the address print doc.Format() return - options_page(mlist, doc, user, cpuser, userlang) + if mlist.isMember(user): + options_page(mlist, doc, user, cpuser, userlang) + else: + loginpage(mlist, doc, user, userlang) print doc.Format() |
