diff options
| author | Barry Warsaw | 2017-01-08 23:21:15 -0500 |
|---|---|---|
| committer | Barry Warsaw | 2017-01-08 23:21:15 -0500 |
| commit | a01ef2bac4d52da67e4be1fccc2634086aaa03e3 (patch) | |
| tree | e077c807084e5f15ea92f4748ffa6bf7e2df92f7 /src/mailman/model | |
| parent | 7b3b9d37f94f744c863b6b96f2d75a558357e397 (diff) | |
| download | mailman-a01ef2bac4d52da67e4be1fccc2634086aaa03e3.tar.gz mailman-a01ef2bac4d52da67e4be1fccc2634086aaa03e3.tar.zst mailman-a01ef2bac4d52da67e4be1fccc2634086aaa03e3.zip | |
Diffstat (limited to 'src/mailman/model')
| -rw-r--r-- | src/mailman/model/pending.py | 7 | ||||
| -rw-r--r-- | src/mailman/model/requests.py | 4 | ||||
| -rw-r--r-- | src/mailman/model/tests/test_listmanager.py | 16 |
3 files changed, 16 insertions, 11 deletions
diff --git a/src/mailman/model/pending.py b/src/mailman/model/pending.py index 023baf8de..5e5a2af83 100644 --- a/src/mailman/model/pending.py +++ b/src/mailman/model/pending.py @@ -166,10 +166,9 @@ class Pendings: pkv_alias_type.value == pend_type )) for pending in query: - if confirm: - yield pending.token, self.confirm(pending.token, expunge=False) - else: - yield pending.token + pendable = (self.confirm(pending.token, expunge=False) + if confirm else None) + yield pending.token, pendable @dbconnection def __iter__(self, store): diff --git a/src/mailman/model/requests.py b/src/mailman/model/requests.py index 0c164172d..90d1c686c 100644 --- a/src/mailman/model/requests.py +++ b/src/mailman/model/requests.py @@ -142,10 +142,10 @@ class ListRequests: @dbconnection def clear(self, store): - for pended_token in getUtility(IPendings).find( + for token, pendable in getUtility(IPendings).find( mlist=self.mailing_list, confirm=False): - pended = store.query(Pended).filter_by(token=pended_token).first() + pended = store.query(Pended).filter_by(token=token).first() store.query(PendedKeyValue).filter_by(pended_id=pended.id).delete() store.delete(pended) diff --git a/src/mailman/model/tests/test_listmanager.py b/src/mailman/model/tests/test_listmanager.py index cdd13ced3..da65f88ce 100644 --- a/src/mailman/model/tests/test_listmanager.py +++ b/src/mailman/model/tests/test_listmanager.py @@ -199,13 +199,19 @@ Message-ID: <argon> def test_pendings_are_deleted_when_mailing_list_is_deleted(self): pendingdb = getUtility(IPendings) - test1_list = create_list('test@example.com') - subscription_1 = SimplePendable( + pendable_1 = SimplePendable( type='subscription', - list_id='test.example.com') - pendingdb.add(subscription_1) + list_id='ant.example.com') + pendingdb.add(pendable_1) + pendable_2 = SimplePendable( + type='subscription', + list_id='bee.example.com') + pendingdb.add(pendable_2) + self.assertEqual(pendingdb.count, 2) + list_manager = getUtility(IListManager) + list_manager.delete(self._ant) self.assertEqual(pendingdb.count, 1) - getUtility(IListManager).delete(test1_list) + list_manager.delete(self._bee) self.assertEqual(pendingdb.count, 0) |
