diff options
| author | bwarsaw | 1999-11-10 17:49:33 +0000 |
|---|---|---|
| committer | bwarsaw | 1999-11-10 17:49:33 +0000 |
| commit | 8e962b2a21fd45fb789f6b793ec5c5010b247206 (patch) | |
| tree | 77ae55b23279751c2d20ee147aadea47a75bb723 /Mailman/Handlers/Approve.py | |
| parent | bec2d8e2c6b288ad6d75113657e360acbb6be149 (diff) | |
| download | mailman-8e962b2a21fd45fb789f6b793ec5c5010b247206.tar.gz mailman-8e962b2a21fd45fb789f6b793ec5c5010b247206.tar.zst mailman-8e962b2a21fd45fb789f6b793ec5c5010b247206.zip | |
New pipeline delivery module
"""Determine whether the message is approved for delivery.
This module only tests for definitive approvals. IOW, this module only
determines whether the message is definitively approved or definitively
denied. Situations that could hold a message for approval or confirmation are
not tested by this module.
"""
Diffstat (limited to 'Mailman/Handlers/Approve.py')
| -rw-r--r-- | Mailman/Handlers/Approve.py | 66 |
1 files changed, 66 insertions, 0 deletions
diff --git a/Mailman/Handlers/Approve.py b/Mailman/Handlers/Approve.py new file mode 100644 index 000000000..b436ed55e --- /dev/null +++ b/Mailman/Handlers/Approve.py @@ -0,0 +1,66 @@ +# Copyright (C) 1998 by the Free Software Foundation, Inc. +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; either version 2 +# of the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +"""Determine whether the message is approved for delivery. + +This module only tests for definitive approvals. IOW, this module only +determines whether the message is definitively approved or definitively +denied. Situations that could hold a message for approval or confirmation are +not tested by this module. + +""" + +import string +import HandlerAPI +from Mailman import mm_cfg +from Mailman import Errors + + +class NotApproved(HandlerAPI.HandlerError): + pass + + +# multiple inheritance for backwards compatibility +class LoopError(NotApproved, Errors.MMLoopingPost): + pass + + + +def process(mlist, msg): + # short circuits + if getattr(msg, 'approved', 0) or \ + getattr(msg, 'isdigest', 0) or \ + getattr(msg, 'fromusenet', 0): + # digests, Usenet postings, and some other messages come + # pre-approved. TBD: we may want to further filter Usenet messages, + # so the test above may not be entirely correct. + return + # See if the message has an Approved: header with a valid password + passwd = msg.getheader('approved') + if passwd and mlist.ValidAdminPassword(passwd): + # TBD: should we definitely deny if the password exists but does not + # match? For now we'll let it percolate up for further + # determination. + msg.approved = 1 + # has this message already been posted to this list? + beentheres = map(filterfunc, msg.getallmatchingheaders('x-beenthere')) + if mlist.GetListEmail() in beentheres: + raise LoopError + + + +def filterfunc(s): + return string.split(s, ': ')[1][-1] |
