"Fossies" - the Fresh Open Source Software Archive

Member "mailman-3.3.7/src/mailman/rules/any.py" (10 Nov 2022, 1226 Bytes) of package /linux/misc/mailman-3.3.7.tar.bz2:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) Python source code syntax highlighting (style: standard) with prefixed line numbers. Alternatively you can here view or download the uninterpreted source code file. For more information about "any.py" see the Fossies "Dox" file reference documentation and the last Fossies "Diffs" side-by-side code changes report: 3.3.5_vs_3.3.6.

    1 # Copyright (C) 2007-2022 by the Free Software Foundation, Inc.
    2 #
    3 # This file is part of GNU Mailman.
    4 #
    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.
    9 #
   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.
   14 #
   15 # You should have received a copy of the GNU General Public License along with
   16 # GNU Mailman.  If not, see <https://www.gnu.org/licenses/>.
   17 
   18 """Check if any previous rules have matched."""
   19 
   20 from mailman.core.i18n import _
   21 from mailman.interfaces.rules import IRule
   22 from public import public
   23 from zope.interface import implementer
   24 
   25 
   26 @public
   27 @implementer(IRule)
   28 class Any:
   29     """Look for any previous rule match."""
   30 
   31     name = 'any'
   32     description = _('Look for any previous rule hit.')
   33     record = False
   34 
   35     def check(self, mlist, msg, msgdata):
   36         """See `IRule`."""
   37         return len(msgdata.get('rule_hits', [])) > 0