diff options
| author | Barry Warsaw | 2011-08-17 20:29:05 -0400 |
|---|---|---|
| committer | Barry Warsaw | 2011-08-17 20:29:05 -0400 |
| commit | 7f32fdd8e82542122909f322d2e35b55511c32de (patch) | |
| tree | 07bf03299c755bf85cd53789137f874975082704 /src/mailman/app/moderator.py | |
| parent | d5f143595e44497617bb0357e3c0213911619b35 (diff) | |
| download | mailman-7f32fdd8e82542122909f322d2e35b55511c32de.tar.gz mailman-7f32fdd8e82542122909f322d2e35b55511c32de.tar.zst mailman-7f32fdd8e82542122909f322d2e35b55511c32de.zip | |
Complete bug 827036 work.
* Add ListCreatingEvent and ListDeletingEvent. These are sent before the
operation actually occurs, whereas the previously added ListCreatedEvent and
ListDeletedEvent are sent after the operation. Specifically, this is
necessary because request database deletion requires the IMailingList
object, which is only available before the list is deleted.
* Add a handler to clear out the requests database for a mailing list, when
the mailing list is about to be deleted.
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) |
