summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: e950389)
raw | patch | inline | side by side (parent: e950389)
author | schlatterbeck <schlatterbeck@57a73879-2fb5-44c3-a270-3262357dd7e2> | |
Wed, 6 Oct 2010 14:13:09 +0000 (14:13 +0000) | ||
committer | schlatterbeck <schlatterbeck@57a73879-2fb5-44c3-a270-3262357dd7e2> | |
Wed, 6 Oct 2010 14:13:09 +0000 (14:13 +0000) |
- fix broken regression-test for message/rfc822 in test_multipart -- the
rfc822 message must have its own header -- this is where we have to
look for the subject. This means we have to include a newline before
the Subject in the test-message, otherwise the Subject line is part of
the mime header, not part of the email attachment.
git-svn-id: http://svn.roundup-tracker.org/svnroot/roundup/roundup/trunk@4531 57a73879-2fb5-44c3-a270-3262357dd7e2
rfc822 message must have its own header -- this is where we have to
look for the subject. This means we have to include a newline before
the Subject in the test-message, otherwise the Subject line is part of
the mime header, not part of the email attachment.
git-svn-id: http://svn.roundup-tracker.org/svnroot/roundup/roundup/trunk@4531 57a73879-2fb5-44c3-a270-3262357dd7e2
roundup/mailgw.py | patch | blob | history | |
test/test_multipart.py | patch | blob | history |
diff --git a/roundup/mailgw.py b/roundup/mailgw.py
index 67cf6a3739e10ad27d22d5f4913e58b7f4d92432..8346b0590cb605ab7a0ac6d4dcba5f1557273f0a 100644 (file)
--- a/roundup/mailgw.py
+++ b/roundup/mailgw.py
# now handle the body - find the message
ig = self.instance.config.MAILGW_IGNORE_ALTERNATIVES
content, attachments = message.extract_content(ignore_alternatives=ig,
- unpack_rfc822 = self.instance.config.MAILGW_UNPACK_RFC822)
+ unpack_rfc822=self.instance.config.MAILGW_UNPACK_RFC822)
if content is None:
raise MailUsageError, _("""
Roundup requires the submission to be plain text. The message parser could
diff --git a/test/test_multipart.py b/test/test_multipart.py
index 5797dd21f35f53e1c2b3c52ec769a63c8806c61c..0cbc384c668a7cf5b9e4bc65f505dd56066a1fd4 100644 (file)
--- a/test/test_multipart.py
+++ b/test/test_multipart.py
from roundup.mailgw import Message
class TestMessage(Message):
+ # A note on message/rfc822: The content of such an attachment is an
+ # email with at least one header line. RFC2046 tells us: """ A
+ # media type of "message/rfc822" indicates that the body contains an
+ # encapsulated message, with the syntax of an RFC 822 message.
+ # However, unlike top-level RFC 822 messages, the restriction that
+ # each "message/rfc822" body must include a "From", "Date", and at
+ # least one destination header is removed and replaced with the
+ # requirement that at least one of "From", "Subject", or "Date" must
+ # be present."""
+ # This means we have to add a newline after the mime-header before
+ # the subject, otherwise the subject is part of the mime header not
+ # part of the email header.
table = {'multipart/signed': ' boundary="boundary-%(indent)s";\n',
'multipart/mixed': ' boundary="boundary-%(indent)s";\n',
'multipart/alternative': ' boundary="boundary-%(indent)s";\n',
'text/plain': ' name="foo.txt"\nfoo\n',
'application/pgp-signature': ' name="foo.gpg"\nfoo\n',
'application/pdf': ' name="foo.pdf"\nfoo\n',
- 'message/rfc822': 'Subject: foo\n\nfoo\n'}
+ 'message/rfc822': '\nSubject: foo\n\nfoo\n'}
def __init__(self, spec):
"""Create a basic MIME message according to 'spec'.
multipart/mixed
message/rfc822""",
(None,
- [('foo', 'message/rfc822', 'foo\n')]))
+ [('foo.eml', 'message/rfc822', 'Subject: foo\n\nfoo\n')]))
def test_suite():
suite = unittest.TestSuite()