Import order flake8 plugin.
[mailman.git] / src / mailman / interfaces / pipeline.py
blobcdef6a76850d79e036b61f5b8297257a017b2929
1 # Copyright (C) 2008-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 """Interface for describing pipelines."""
20 from mailman import public
21 from zope.interface import Attribute, Interface
24 # For i18n extraction.
25 def _(s):
26 return s
29 # These are thrown but they aren't exceptions so don't inherit from
30 # mailman.interfaces.errors.MailmanError. Python requires that they inherit
31 # from BaseException.
32 @public
33 class DiscardMessage(BaseException):
34 """The message can be discarded with no further action"""
36 def __init__(self, message=None):
37 self.message = message
39 def __str__(self):
40 return self.message
43 @public
44 class RejectMessage(BaseException):
45 """The message will be bounced back to the sender"""
47 def __init__(self, message=None):
48 self.message = message
50 def __str__(self):
51 return self.message
54 @public
55 class IPipeline(Interface):
56 """A pipeline of handlers."""
58 name = Attribute('Pipeline name; must be unique.')
59 description = Attribute('A brief description of this pipeline.')
61 def __iter__():
62 """Iterate over all the handlers in this pipeline."""