diff options
| author | J08nY | 2017-07-12 18:57:01 +0200 |
|---|---|---|
| committer | J08nY | 2017-08-07 18:18:00 +0200 |
| commit | 139a4b484415843d4f0dcf723ed7b56fc52b2547 (patch) | |
| tree | c9d1f401f7f044e85a8851fb15648b71b6d1e7a7 /src/mailman/app/subscriptions.py | |
| parent | 39fba3777fc7d37414368f40bf3504dadaa1841a (diff) | |
| download | mailman-139a4b484415843d4f0dcf723ed7b56fc52b2547.tar.gz mailman-139a4b484415843d4f0dcf723ed7b56fc52b2547.tar.zst mailman-139a4b484415843d4f0dcf723ed7b56fc52b2547.zip | |
Diffstat (limited to 'src/mailman/app/subscriptions.py')
| -rw-r--r-- | src/mailman/app/subscriptions.py | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/src/mailman/app/subscriptions.py b/src/mailman/app/subscriptions.py index cc28ea859..a0c0c8059 100644 --- a/src/mailman/app/subscriptions.py +++ b/src/mailman/app/subscriptions.py @@ -17,6 +17,7 @@ """Handle subscriptions.""" +from mailman.config import config from mailman.database.transaction import flush from mailman.interfaces.listmanager import ListDeletingEvent from mailman.interfaces.pending import IPendings @@ -56,11 +57,13 @@ class SubscriptionManager: if pendable is None: raise LookupError workflow_type = pendable.get('type') - assert workflow_type in (PendableSubscription.PEND_TYPE, - PendableUnsubscription.PEND_TYPE) - workflow = (self._mlist.subscription_policy - if workflow_type == PendableSubscription.PEND_TYPE - else self._mlist.unsubscription_policy)(self._mlist) + if workflow_type in {PendableSubscription.PEND_TYPE, + PendableUnsubscription.PEND_TYPE}: + workflow = (self._mlist.subscription_policy + if workflow_type == PendableSubscription.PEND_TYPE + else self._mlist.unsubscription_policy)(self._mlist) + else: + workflow = config.workflows[workflow_type](self._mlist) workflow.token = token workflow.restore() # In order to just run the whole workflow, all we need to do @@ -84,6 +87,6 @@ def handle_ListDeletingEvent(event): return # Find all the members still associated with the mailing list. members = getUtility(ISubscriptionService).find_members( - list_id=event.mailing_list.list_id) + list_id=event.mailing_list.list_id) for member in members: member.unsubscribe() |
