From a70edc26ac027f6278a38bbe10c921b962adbf7a Mon Sep 17 00:00:00 2001 From: Mark Sapiro Date: Tue, 19 Apr 2016 15:53:54 -0700 Subject: Use nonmember_rejection_notice as the default reject reason for a held nonmember post. --- Mailman/Handlers/Hold.py | 12 ++++++++++-- NEWS | 9 +++++++++ 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/Mailman/Handlers/Hold.py b/Mailman/Handlers/Hold.py index 5452d06a..dcc7f963 100644 --- a/Mailman/Handlers/Hold.py +++ b/Mailman/Handlers/Hold.py @@ -1,4 +1,4 @@ -# Copyright (C) 1998-2011 by the Free Software Foundation, Inc. +# Copyright (C) 1998-2016 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 @@ -28,6 +28,7 @@ Finally an exception is raised to let the pipeline machinery know that further message handling should stop. """ +import re import email from email.MIMEText import MIMEText from email.MIMEMessage import MIMEMessage @@ -220,7 +221,14 @@ def hold_for_approval(mlist, msg, msgdata, exc): # We need to send both the reason and the rejection notice through the # translator again, because of the games we play above reason = Utils.wrap(exc.reason_notice()) - msgdata['rejection_notice'] = Utils.wrap(exc.rejection_notice(mlist)) + if isinstance(exc, NonMemberPost) and mlist.nonmember_rejection_notice: + msgdata['rejection_notice'] = Utils.wrap(re.sub( + '%(listowner)s', + mlist.GetOwnerEmail(), + mlist.nonmember_rejection_notice, + )) + else: + msgdata['rejection_notice'] = Utils.wrap(exc.rejection_notice(mlist)) id = mlist.HoldMessage(msg, reason, msgdata) # Now we need to craft and send a message to the list admin so they can # deal with the held message. diff --git a/NEWS b/NEWS index 1ce0d7c2..a6947393 100644 --- a/NEWS +++ b/NEWS @@ -5,6 +5,15 @@ Copyright (C) 1998-2016 by the Free Software Foundation, Inc. Here is a history of user visible changes to Mailman. +2.1.2 (xx-xxx-xxxx) + + New Features + + - A list's nonmember_rejection_notice attribute will now be the default + rejection reason for a held non-member post in addition to it's prior + role as the reson for an automatically rejected non-member post. + (LP: #1572330) + 2.1.22 (17-Apr-2016) i18n -- cgit v1.2.3