From 7329048d8212f12722536ae52bb828f59e1680aa Mon Sep 17 00:00:00 2001 From: bwarsaw Date: Wed, 24 Nov 1999 19:32:47 +0000 Subject: Convert message delivery to pipeline architecture by using HandlerAPI.DeliverToUser() for fast track delivery of the acknowledgement to the sender. We need to be a little tricky digging the original sender out of a msg object attribute, since CookHeaders (which sets the attribute) changes it for the outgoing message. If msg.original_sender isn't found, use the normal msg.GetSender(). --- Mailman/Handlers/Hold.py | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'Mailman/Handlers/Hold.py') diff --git a/Mailman/Handlers/Hold.py b/Mailman/Handlers/Hold.py index 13a78ef5f..8e5e4e10f 100644 --- a/Mailman/Handlers/Hold.py +++ b/Mailman/Handlers/Hold.py @@ -39,6 +39,7 @@ except ImportError: import pickle import HandlerAPI +from Mailman import Message from Mailman import mm_cfg from Mailman import Utils @@ -177,6 +178,7 @@ def hold_for_approval(mlist, msg, excclass): mlist.LogMsg('vette', '%s post from %s held: %s' % (listname, sender, reason)) if mlist.admin_immed_notify: + # get the text from the template subject = '%s post from %s requires approval' % (listname, sender) text = Utils.maketext( 'postauth.txt', @@ -187,10 +189,10 @@ def hold_for_approval(mlist, msg, excclass): 'subject' : msg.get('subject', '(no subject)'), 'admindb_url': mlist.GetAbsoluteScriptURL('admindb'), }, raw=1) - # TBD: we should send the message to the admin using the same - # mechanism used to post messages to the list (e.g. if we're doing - # sendmail injection, we should use it for all sent messages) - mlist.SendTextToUser(subject=subject, - recipient=mlist.GetAdminEmail(), - text=text) + # craft the admin notification message and deliver it + adminaddr = mlist.GetAdminEmail() + msg = Message.UserNotification(adminaddr, adminaddr, subject, text) + HandlerAPI.DeliverToUser(mlist, msg) + # raise the specific MessageHeld exception to exit out of the message + # delivery pipeline raise excclass -- cgit v1.2.3-70-g09d2