Title: Python 3 MIME generator dies if not given boundary
Type: crash Stage:
Components: Library (Lib) Versions: Python 3.2
Status: closed Resolution: duplicate
Dependencies: Superseder: Faster output if message already has a boundary
View: 1243654
Assigned To: Nosy List: SilentGhost, brandon-rhodes
Priority: normal Keywords: patch

Created on 2011-01-13 17:22 by brandon-rhodes, last changed 2011-01-13 17:47 by SilentGhost. This issue is now closed.

File name Uploaded Description Edit
email-boundary.diff brandon-rhodes, 2011-01-13 17:24
Messages (3)
msg126187 - (view) Author: Brandon Rhodes (brandon-rhodes) * Date: 2011-01-13 17:22
If you try doing "msg.as_string()" to a MIMEMultipart message that has not been given a boundary, then it dies with this exception:

Traceback (most recent call last):
  File "", line 40, in <module>
  File "/home/brandon/python3.2b2/lib/python3.2/email/", line 164, in as_string
    g.flatten(self, unixfrom=unixfrom)
  File "/home/brandon/python3.2b2/lib/python3.2/email/", line 88, in flatten
  File "/home/brandon/python3.2b2/lib/python3.2/email/", line 134, in _write
  File "/home/brandon/python3.2b2/lib/python3.2/email/", line 160, in _dispatch
  File "/home/brandon/python3.2b2/lib/python3.2/email/", line 234, in _handle_multipart
    self.write('--' + boundary + self._NL)
TypeError: Can't convert 'NoneType' object to str implicitly
msg126188 - (view) Author: Brandon Rhodes (brandon-rhodes) * Date: 2011-01-13 17:24
Here is a patch that fixes the problem. The problem probably only occurs if the MIMEMultipart is actually given several MIME parts to use in its interior.
msg126189 - (view) Author: SilentGhost (SilentGhost) * (Python triager) Date: 2011-01-13 17:47
It is a duplicate of #1243654. Closing.
Date User Action Args
2011-01-13 17:47:02SilentGhostsetstatus: open -> closed

nosy: + SilentGhost
messages: + msg126189

superseder: Faster output if message already has a boundary
resolution: duplicate
2011-01-13 17:24:38brandon-rhodessetfiles: + email-boundary.diff

messages: + msg126188
keywords: + patch
2011-01-13 17:22:24brandon-rhodescreate