diff options
| author | bwarsaw | 2002-10-15 05:50:41 +0000 |
|---|---|---|
| committer | bwarsaw | 2002-10-15 05:50:41 +0000 |
| commit | 4f1b36f056859d697c9d8afe978b46e4082a09a5 (patch) | |
| tree | 2c9992c19daad5826fea1122c8e5af2fea54565c | |
| parent | f4fa04dd9e099cfffeb8833f89d899c5b12b3965 (diff) | |
| download | mailman-4f1b36f056859d697c9d8afe978b46e4082a09a5.tar.gz mailman-4f1b36f056859d697c9d8afe978b46e4082a09a5.tar.zst mailman-4f1b36f056859d697c9d8afe978b46e4082a09a5.zip | |
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.
| -rw-r--r-- | Mailman/Message.py | 15 |
1 files changed, 15 insertions, 0 deletions
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() |
