Import order flake8 plugin.
[mailman.git] / src / mailman / interfaces / rules.py
blob9f5f1365e0224dc9f995c6d40c175de3382ae4ed
1 # Copyright (C) 2007-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 describing the basics of rules."""
20 from mailman import public
21 from zope.interface import Attribute, Interface
24 @public
25 class IRule(Interface):
26 """A basic rule."""
28 name = Attribute('Rule name; must be unique.')
30 description = Attribute('A brief description of the rule.')
32 record = Attribute(
33 """Should this rule's success or failure be recorded?
35 This is a boolean; if True then this rule's hit or miss will be
36 recorded in a message header. If False, it won't.
37 """)
39 def check(mlist, msg, msgdata):
40 """Run the rule.
42 :param mlist: The mailing list object.
43 :param msg: The message object.
44 :param msgdata: The message metadata.
45 :returns: a boolean specifying whether the rule matched or not.
46 """