1 # Copyright (C) 2009-2019 by the Free Software Foundation, Inc.
3 # This file is part of GNU Mailman.
5 # GNU Mailman is free software: you can redistribute it and/or modify it under
6 # the terms of the GNU General Public License as published by the Free
7 # Software Foundation, either version 3 of the License, or (at your option)
10 # GNU Mailman is distributed in the hope that it will be useful, but WITHOUT
11 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12 # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
15 # You should have received a copy of the GNU General Public License along with
16 # GNU Mailman. If not, see <http://www.gnu.org/licenses/>.
18 """One last digest."""
20 from mailman
.database
.model
import Model
21 from mailman
.database
.types
import Enum
22 from mailman
.interfaces
.digests
import IOneLastDigest
23 from mailman
.interfaces
.member
import DeliveryMode
24 from public
import public
25 from sqlalchemy
import Column
, ForeignKey
, Integer
26 from sqlalchemy
.orm
import relationship
27 from zope
.interface
import implementer
31 @implementer(IOneLastDigest
)
32 class OneLastDigest(Model
):
33 """See `IOneLastDigest`."""
35 __tablename__
= 'onelastdigest'
37 id = Column(Integer
, primary_key
=True)
39 mailing_list_id
= Column(Integer
, ForeignKey('mailinglist.id'))
40 mailing_list
= relationship('MailingList')
42 address_id
= Column(Integer
, ForeignKey('address.id'))
43 address
= relationship('Address')
45 delivery_mode
= Column(Enum(DeliveryMode
))
47 def __init__(self
, mailing_list
, address
, delivery_mode
):
48 self
.mailing_list
= mailing_list
49 self
.address
= address
50 self
.delivery_mode
= delivery_mode