aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorbwarsaw <>2003-12-01 01:52:12 +0000
committerbwarsaw <>2003-12-01 01:52:12 +0000
commit9c667c34c3c362b34cd7458d74df98cde0fab127 (patch)
treeec0b20af2d34fd1c2e1252b4046b9e852f02e21b
parent69e9d4773ddf364ff24c8f8bbfc6242b93a4a378 (diff)
downloadmailman2-9c667c34c3c362b34cd7458d74df98cde0fab127.tar.gz
mailman2-9c667c34c3c362b34cd7458d74df98cde0fab127.tar.xz
mailman2-9c667c34c3c362b34cd7458d74df98cde0fab127.zip
Results.__init__(): It's possible for the Header functions to raise a
HeaderParseError, so if that happens just ignore the Subject header for command purposes.
-rw-r--r--Mailman/Queue/CommandRunner.py13
1 files changed, 9 insertions, 4 deletions
diff --git a/Mailman/Queue/CommandRunner.py b/Mailman/Queue/CommandRunner.py
index 524ea575..f1f94835 100644
--- a/Mailman/Queue/CommandRunner.py
+++ b/Mailman/Queue/CommandRunner.py
@@ -40,9 +40,10 @@ from Mailman.Logging.Syslog import syslog
from Mailman import LockFile
from email.Header import decode_header, make_header, Header
+from email.Errors import HeaderParseError
+from email.Iterators import typed_subpart_iterator
from email.MIMEText import MIMEText
from email.MIMEMessage import MIMEMessage
-from email.Iterators import typed_subpart_iterator
NL = '\n'
@@ -72,9 +73,13 @@ class Results:
# Extract the subject header and do RFC 2047 decoding. Note that
# Python 2.1's unicode() builtin doesn't call obj.__unicode__().
subj = msg.get('subject', '')
- subj = make_header(decode_header(subj)).__unicode__()
- # Always process the Subject: header first
- self.commands.append(subj)
+ try:
+ subj = make_header(decode_header(subj)).__unicode__()
+ # Always process the Subject: header first
+ self.commands.append(subj)
+ except HeaderParseError:
+ # We couldn't parse it so ignore the Subject header
+ pass
# Find the first text/plain part
part = None
for part in typed_subpart_iterator(msg, 'text', 'plain'):