From 4f1b36f056859d697c9d8afe978b46e4082a09a5 Mon Sep 17 00:00:00 2001 From: bwarsaw Date: Tue, 15 Oct 2002 05:50:41 +0000 Subject: OwnerNotification: New convenience class, derives from UserNotification but provides a different constructor. It calculates the recipients from the list's owners and, if the tomoderators flag is true (the default), includes the list's moderators. The ctor also munges the To header so that it looks like it's being sent to the list's -owner address. --- Mailman/Message.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/Mailman/Message.py b/Mailman/Message.py index 77cd48733..0d1313a39 100644 --- a/Mailman/Message.py +++ b/Mailman/Message.py @@ -237,3 +237,18 @@ class UserNotification(Message): nodecorate = 1, reduced_list_headers = 1, **_kws) + + + +class OwnerNotification(UserNotification): + """Like user notifications, but this message goes to the list owners.""" + + def __init__(self, mlist, sender, subject=None, text=None, tomoderators=1): + recips = mlist.owner[:] + if tomoderators: + recips.extend(mlist.moderator) + lang = mlist.preferred_language + UserNotification.__init__(self, recips, sender, subject, text, lang) + # Hack the To header to look like it's going to the -owner address + del self['to'] + self['To'] = mlist.GetOwnerEmail() -- cgit v1.3.1