diff --git a/Doc/library/email.message.rst b/Doc/library/email.message.rst index 58f708c..c0aea5f 100644 --- a/Doc/library/email.message.rst +++ b/Doc/library/email.message.rst @@ -131,7 +131,11 @@ Here are the methods of the :class:`Message` class: Return ``True`` if the message's payload is a list of sub-\ :class:`Message` objects, otherwise return ``False``. When - :meth:`is_multipart` returns ``False``, the payload should be a string object. + :meth:`is_multipart` returns ``False``, the payload should be a string + object. Although if :meth:`is_multipart` does return ``True``, it does + not mean "msg.get_content_maintype() == 'multipart'" will return + the same answer. (An example would be when the :class:`Message` is of + type ``message/rfc822``) .. method:: set_unixfrom(unixfrom) @@ -589,6 +593,7 @@ Here are the methods of the :class:`Message` class: >>> from email import message_from_binary_file >>> with open('Lib/test/test_email/data/msg_16.txt', 'rb') as f: ... msg = message_from_binary_file(f) + >>> from email.iterators import _structure .. doctest:: @@ -605,6 +610,29 @@ Here are the methods of the :class:`Message` class: :class:`Message` objects can also optionally contain two instance attributes, which can be used when generating the plain text of a MIME message. + This method iterates over the subparts of any part where :meth:`is_multipart` + returns ``True`` even though ``msg.get_content_maintype() == 'multipart'`` + returns ``False``. Here is an example showing that: + + .. doctest:: + + >>> for part in msg.walk(): + ... print(part.get_content_maintype() == 'multipart') + True + False + False + False + False + False + False + >>> _structure(msg) + multipart/report + text/plain + message/delivery-status + text/plain + text/plain + message/rfc822 + text/plain .. attribute:: preamble