Clean up the mta directory.
[mailman.git] / src / mailman / mta / decorating.py
blobe9d6f57853b29e7b418035a99e70a7640aa39772
1 # Copyright (C) 2009-2016 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)
8 # any later version.
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
13 # more details.
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 """Individualized delivery with header/footer decorations."""
20 from mailman import public
21 from mailman.config import config
22 from mailman.mta.verp import VERPDelivery
25 @public
26 class DecoratingMixin:
27 """Decorate a message with recipient-specific headers and footers."""
29 def decorate(self, mlist, msg, msgdata):
30 """Add recipient-specific headers and footers."""
31 decorator = config.handlers['decorate']
32 decorator.process(mlist, msg, msgdata)
33 # Do not decorate a message more than once.
34 msgdata['nodecorate'] = True
37 @public
38 class DecoratingDelivery(DecoratingMixin, VERPDelivery):
39 """Add recipient-specific headers and footers."""
41 def __init__(self):
42 """See `IndividualDelivery`."""
43 super().__init__()
44 self.callbacks.append(self.decorate)