Remove the mailman.interface magic. Use the more specific interface imports.
[mailman.git] / mailman / rules / no_subject.py
blob08848154d7876d9f78ae8bd07b83103234f9669a
1 # Copyright (C) 2007-2009 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 """The no-Subject header rule."""
20 __all__ = ['NoSubject']
21 __metaclass__ = type
24 from zope.interface import implements
26 from mailman.i18n import _
27 from mailman.interfaces.rules import IRule
31 class NoSubject:
32 """The no-Subject rule."""
33 implements(IRule)
35 name = 'no-subject'
36 description = _('Catch messages with no, or empty, Subject headers.')
37 record = True
39 def check(self, mlist, msg, msgdata):
40 """See `IRule`."""
41 subject = msg.get('subject', '').strip()
42 return subject == ''