diff options
author | msapiro <> | 2005-12-03 01:08:58 +0000 |
---|---|---|
committer | msapiro <> | 2005-12-03 01:08:58 +0000 |
commit | d77d0dfed39748444d772bd1c1aacbdb4fbfd20a (patch) | |
tree | 21297fc61321b4d6fa51d0650da887fe856cd454 /Mailman/Cgi | |
parent | 6dd2b7fdf06cb3a9e6bc461efe3ab17e73dbe939 (diff) | |
download | mailman2-d77d0dfed39748444d772bd1c1aacbdb4fbfd20a.tar.gz mailman2-d77d0dfed39748444d772bd1c1aacbdb4fbfd20a.tar.xz mailman2-d77d0dfed39748444d772bd1c1aacbdb4fbfd20a.zip |
Improving banned subscription logic to cover all invites, subscribes, address changes and confirmations of same.
Diffstat (limited to 'Mailman/Cgi')
-rw-r--r-- | Mailman/Cgi/admin.py | 5 | ||||
-rw-r--r-- | Mailman/Cgi/admindb.py | 9 | ||||
-rw-r--r-- | Mailman/Cgi/confirm.py | 13 | ||||
-rw-r--r-- | Mailman/Cgi/options.py | 5 |
4 files changed, 29 insertions, 3 deletions
diff --git a/Mailman/Cgi/admin.py b/Mailman/Cgi/admin.py index eb63e008..b75ff2df 100644 --- a/Mailman/Cgi/admin.py +++ b/Mailman/Cgi/admin.py @@ -1,4 +1,4 @@ -# Copyright (C) 1998-2004 by the Free Software Foundation, Inc. +# Copyright (C) 1998-2005 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 @@ -1345,6 +1345,9 @@ def change_options(mlist, category, subcat, cgidata, doc): except Errors.MMHostileAddress: subscribe_errors.append( (entry, _('Hostile address (illegal characters)'))) + except Errors.MembershipIsBanned, pattern: + subscribe_errors.append( + (entry, _('Banned address (matched %(pattern)s)'))) else: member = Utils.uncanonstr(formataddr((fullname, address))) subscribe_success.append(Utils.websafe(member)) diff --git a/Mailman/Cgi/admindb.py b/Mailman/Cgi/admindb.py index 1dd0e28a..3f421cfe 100644 --- a/Mailman/Cgi/admindb.py +++ b/Mailman/Cgi/admindb.py @@ -1,4 +1,4 @@ -# Copyright (C) 1998-2004 by the Free Software Foundation, Inc. +# Copyright (C) 1998-2005 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 @@ -745,6 +745,7 @@ def process_form(mlist, doc, cgidata): if sender not in mlist.ban_list: mlist.ban_list.append(sender) # Now, do message specific actions + banaddrs = [] erroraddrs = [] for k in cgidata.keys(): formv = cgidata[k] @@ -794,8 +795,14 @@ def process_form(mlist, doc, cgidata): continue except Errors.MMAlreadyAMember, v: erroraddrs.append(v) + except Errors.MembershipIsBanned, pattern: + sender = mlist.GetRecord(request_id)[1] + banaddrs.append((sender, pattern)) # save the list and print the results doc.AddItem(Header(2, _('Database Updated...'))) if erroraddrs: for addr in erroraddrs: doc.AddItem(`addr` + _(' is already a member') + '<br>') + if banaddrs: + for addr, patt in banaddrs: + doc.AddItem(_('%(addr)s is banned (matched: %(patt)s)') + '<br>') diff --git a/Mailman/Cgi/confirm.py b/Mailman/Cgi/confirm.py index d2cf0cce..6238e72a 100644 --- a/Mailman/Cgi/confirm.py +++ b/Mailman/Cgi/confirm.py @@ -1,4 +1,4 @@ -# Copyright (C) 2001-2004 by the Free Software Foundation, Inc. +# Copyright (C) 2001-2005 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 @@ -370,6 +370,11 @@ def subscription_confirm(mlist, doc, cookie, cgidata): address that has already been unsubscribed.''')) except Errors.MMAlreadyAMember: doc.addError(_("You are already a member of this mailing list!")) + except Errors.MembershipIsBanned: + owneraddr = mlist.GetOwnerEmail() + doc.addError(_("""You are currently banned from subscribing to + this list. If you think this restriction is erroneous, please + contact the list owners at %(owneraddr)s.""")) except Errors.HostileSubscriptionError: doc.addError(_("""\ You were not invited to this mailing list. The invitation has @@ -517,6 +522,12 @@ def addrchange_confirm(mlist, doc, cookie): bad_confirmation(doc, _('''Invalid confirmation string. It is possible that you are attempting to confirm a request for an address that has already been unsubscribed.''')) + except Errors.MembershipIsBanned: + owneraddr = mlist.GetOwnerEmail() + realname = mlist.real_name + 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.""")) else: # The response listname = mlist.real_name diff --git a/Mailman/Cgi/options.py b/Mailman/Cgi/options.py index ed40e828..eb7adb67 100644 --- a/Mailman/Cgi/options.py +++ b/Mailman/Cgi/options.py @@ -399,6 +399,11 @@ address. Upon confirmation, any other mailing list containing the address msg = _('Illegal email address provided') except Errors.MMAlreadyAMember: msg = _('%(newaddr)s is already a member of the list.') + except Errors.MembershipIsBanned: + owneraddr = mlist.GetOwnerEmail() + msg = _("""%(newaddr)s is banned from this list. If you + think this restriction is erroneous, please contact + the list owners at %(owneraddr)s.""") if set_membername: mlist.Lock() |