[issue7119] email: msg.items() returns different values before and after msg.as_string()

Jon Nelson report at bugs.python.org
Tue Oct 13 20:58:06 CEST 2009


New submission from Jon Nelson <jnelson at users.sourceforge.net>:

import os
try:
  from email.mime.multipart import MIMEMultipart
except ImportError:
  from email.MIMEMultipart import MIMEMultipart

m = MIMEMultipart('form-data')

print m.items()
m.as_string()
print m.items()


print out:

[('Content-Type', 'multipart/form-data'), ('MIME-Version', '1.0')]
[('Content-Type', 'multipart/form-data;
boundary="===============0836597002796039051=="'), ('MIME-Version', '1.0')]

The latter is correct, the former is not - it is missing the boundary!
items() should behave the same regardless of whether or not as_string()
has been called.


Confirmed in 2.4 and 2.6

----------
components: Library (Lib)
messages: 93935
nosy: jnelson
severity: normal
status: open
title: email:  msg.items() returns different values before and after msg.as_string()
type: behavior
versions: Python 2.4, Python 2.5, Python 2.6

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue7119>
_______________________________________


More information about the Python-bugs-list mailing list