From ac2fdda2b90f0dcea205f494751335fcc93cddc5 Mon Sep 17 00:00:00 2001 From: Aurélien Bompard Date: Fri, 12 Feb 2016 18:03:24 +0100 Subject: Use a better way to delete from a collection --- src/mailman/model/mailinglist.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/mailman/model/mailinglist.py b/src/mailman/model/mailinglist.py index 1d7bdd3a3..6f59a1662 100644 --- a/src/mailman/model/mailinglist.py +++ b/src/mailman/model/mailinglist.py @@ -708,9 +708,8 @@ class HeaderMatchList: @dbconnection def clear(self, store): """See `IHeaderMatchList`.""" - store.query(HeaderMatch).filter( - HeaderMatch.mailing_list == self._mailing_list).delete() - store.expire(self._mailing_list, ['header_matches']) + # http://docs.sqlalchemy.org/en/latest/orm/session_basics.html#deleting-from-collections + del self._mailing_list.header_matches[:] @dbconnection def append(self, store, header, pattern, action=None): -- cgit v1.2.3-70-g09d2