Import order flake8 plugin.
[mailman.git] / src / mailman / interfaces / mime.py
blobc1a6e050f6c122977638f49c89390fca0400c7c9
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 """MIME content filtering."""
20 from enum import Enum
21 from mailman import public
22 from zope.interface import Attribute, Interface
25 @public
26 class FilterAction(Enum):
27 # Discard a message that matches the content type filter.
28 discard = 0
29 # Bounce the message back to the original author.
30 bounce = 1
31 # Discard and forward the message on to the list owner.
32 forward = 2
33 # Discard, but preserve it.
34 preserve = 3
37 @public
38 class FilterType(Enum):
39 # Filter MIME type.
40 filter_mime = 0
41 # Pass MIME type.
42 pass_mime = 1
43 # Filter file extension.
44 filter_extension = 2
45 # Pass file extension.
46 pass_extension = 3
49 @public
50 class IContentFilter(Interface):
51 """A single content filter settings for a mailing list."""
53 mailing_list = Attribute(
54 """The mailing list for this content filter.""")
56 filter_pattern = Attribute(
57 """The filter/pass content pattern.""")
59 filter_type = Attribute(
60 """Type of filter.""")