def find(self, store, *, advertised=None, mail_host=None): query = store.query(MailingList) if advertised is not None: query = query.filter_by(advertised=advertised) if mail_host is not None: query = query.filter_by(mail_host=mail_host) query = query.order_by(MailingList._list_id) return QuerySequence(query)
def find(self, store, *, advertised=None, mail_host=None, owner=None): query = store.query(MailingList) if advertised is not None: query = query.filter_by(advertised=advertised) if mail_host is not None: query = query.filter_by(mail_host=mail_host) if owner is not None: query = query.join(Member, MailingList._list_id == Member.list_id).join( Address, Member.address_id == Address.id).filter( Address.email == owner, Member.role == MemberRole.owner) query = query.order_by(MailingList._list_id) return QuerySequence(query)
def find_members(self, subscriber=None, list_id=None, role=None): """See `ISubscriptionService`.""" return QuerySequence(self._find_members(subscriber, list_id, role))
def of_type(self, store, request_type): return QuerySequence( store.query(_Request).filter_by( mailing_list=self.mailing_list, request_type=request_type).order_by(_Request.id))
def test_iterate_with_none(self): query = QuerySequence(None) self.assertEqual(list(query), [])
def test_index_error(self): query = QuerySequence(None) self.assertRaises(IndexError, getitem, query, 1)
def bans(self, store): """See `IBanManager`.""" query = store.query(Ban).filter_by( list_id=self._list_id).order_by(Ban.email) return QuerySequence(query)