aboutsummaryrefslogtreecommitdiffstats
path: root/Mailman/Handlers/Approve.py
diff options
context:
space:
mode:
authorbwarsaw <>2005-05-01 22:46:34 +0000
committerbwarsaw <>2005-05-01 22:46:34 +0000
commit7cfb5dec123bb54c323bef71fd8e5b9f2cc7d13d (patch)
tree5d90f342255d1c48254fd0473db89d6ba42bc963 /Mailman/Handlers/Approve.py
parent3ce85e4b97dbdff3225d4358d044056fa4110832 (diff)
downloadmailman2-7cfb5dec123bb54c323bef71fd8e5b9f2cc7d13d.tar.gz
mailman2-7cfb5dec123bb54c323bef71fd8e5b9f2cc7d13d.tar.xz
mailman2-7cfb5dec123bb54c323bef71fd8e5b9f2cc7d13d.zip
process(): For some reason, the part's payload can be None. Defend against
trying to call None.splitlines().
Diffstat (limited to '')
-rw-r--r--Mailman/Handlers/Approve.py13
1 files changed, 7 insertions, 6 deletions
diff --git a/Mailman/Handlers/Approve.py b/Mailman/Handlers/Approve.py
index d339a9b1..98490ba3 100644
--- a/Mailman/Handlers/Approve.py
+++ b/Mailman/Handlers/Approve.py
@@ -1,17 +1,17 @@
-# Copyright (C) 1998,1999,2000,2001,2002 by the Free Software Foundation, Inc.
+# Copyright (C) 1998-2005 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
+# 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.
@@ -20,7 +20,6 @@ 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.
-
"""
from email.Iterators import typed_subpart_iterator
@@ -52,7 +51,9 @@ def process(mlist, msg, msgdata):
part = None
for part in typed_subpart_iterator(msg, 'text', 'plain'):
break
- if part is not None:
+ # XXX I'm not entirely sure why, but it is possible for the payload of
+ # the part to be None, and you can't splitlines() on None.
+ if part is not None and part.get_payload() is not None:
lines = part.get_payload().splitlines()
line = ''
for lineno, line in zip(range(len(lines)), lines):