diff options
| author | Barry Warsaw | 2011-08-17 20:39:11 -0400 |
|---|---|---|
| committer | Barry Warsaw | 2011-08-17 20:39:11 -0400 |
| commit | 545735d6dc0efb76b88f3f0634966f97d833dc41 (patch) | |
| tree | a235c693656b2c42c239b674f81319f66f2df5a0 /src/mailman/app/moderator.py | |
| parent | 51319c7b0f1790b32ec360366ab3435b042363e2 (diff) | |
| parent | 7f32fdd8e82542122909f322d2e35b55511c32de (diff) | |
| download | mailman-545735d6dc0efb76b88f3f0634966f97d833dc41.tar.gz mailman-545735d6dc0efb76b88f3f0634966f97d833dc41.tar.zst mailman-545735d6dc0efb76b88f3f0634966f97d833dc41.zip | |
* Four new events are created, and notifications are sent during mailing list
lifecycle changes:
- ListCreatingEvent - sent before the mailing list is created
- ListCreatedEvent - sent after the mailing list is created
- ListDeletingEvent - sent before the mailing list is deleted
- ListDeletedEvent - sent after the mailing list is deleted
* Using the above events, when a mailing list is deleted, all its members are
deleted, as well as all held message requests (but not the held messages
themselves). (LP: 827036)
Also: relax the find_member() argument constraints so that even the subscriber
email address is optional. This is mirrored in the REST API's
.../members/find resource.
Diffstat (limited to 'src/mailman/app/moderator.py')
| -rw-r--r-- | src/mailman/app/moderator.py | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/mailman/app/moderator.py b/src/mailman/app/moderator.py index 1b9f21d2a..0ba6f492a 100644 --- a/src/mailman/app/moderator.py +++ b/src/mailman/app/moderator.py @@ -21,6 +21,7 @@ from __future__ import absolute_import, unicode_literals __metaclass__ = type __all__ = [ + 'handle_ListDeletingEvent', 'handle_message', 'handle_subscription', 'handle_unsubscription', @@ -43,6 +44,7 @@ from mailman.core.i18n import _ from mailman.email.message import UserNotification from mailman.interfaces.action import Action from mailman.interfaces.languages import ILanguageManager +from mailman.interfaces.listmanager import ListDeletingEvent from mailman.interfaces.member import ( AlreadySubscribedError, DeliveryMode, NotAMemberError) from mailman.interfaces.messages import IMessageStore @@ -355,3 +357,14 @@ def _refuse(mlist, request, recip, comment, origmsg=None, lang=None): subject = _('Request to mailing list "$realname" rejected') msg = UserNotification(recip, mlist.bounces_address, subject, text, lang) msg.send(mlist) + + + +def handle_ListDeletingEvent(event): + if not isinstance(event, ListDeletingEvent): + return + # Get the held requests database for the mailing list. Since the mailing + # list is about to get deleted, we can delete all associated requests. + requestsdb = getUtility(IRequests).get_list_requests(event.mailing_list) + for request in requestsdb.held_requests: + requestsdb.delete_request(request.id) |
