Ejemplo n.º 1
0
 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)
Ejemplo n.º 2
0
 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)
Ejemplo n.º 3
0
 def find_members(self, subscriber=None, list_id=None, role=None):
     """See `ISubscriptionService`."""
     return QuerySequence(self._find_members(subscriber, list_id, role))
Ejemplo n.º 4
0
 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))
Ejemplo n.º 5
0
 def test_iterate_with_none(self):
     query = QuerySequence(None)
     self.assertEqual(list(query), [])
Ejemplo n.º 6
0
 def test_index_error(self):
     query = QuerySequence(None)
     self.assertRaises(IndexError, getitem, query, 1)
Ejemplo n.º 7
0
 def bans(self, store):
     """See `IBanManager`."""
     query = store.query(Ban).filter_by(
         list_id=self._list_id).order_by(Ban.email)
     return QuerySequence(query)