New submission from R. David Murray:

A 'message' part is not, in fact, a multipart in RFC terms.  (Only 'multipart' 
messages are multiparts.)  The email package models 'message' parts by making 
them single-element "multipart" messages, with the single element being a 
Message object representing the 'message' part's payload.

This is very useful; however, the fact that this is done should be documented 
in at least the is_multipart and walk methods.  As motivation for documenting 
this, consider a program that is looking for "the first part of type X" in a 
Message.  If an attached 'message' object has such a part, it would be 
discovered by a naive algorithm that uses 'walk', even though it is *inside* an 
attachment instead of part of the main message.  As for is_multipart, a naive 
reader of the documentation might expect that is_multipart would be true if and 
only if get_content_maintype == 'multipart', when this is in fact not true.

(I made these mistakes myself while implementing get_body and iter_parts in the 
new API additions.)

----------
components: email
messages: 196292
nosy: barry, r.david.murray
priority: normal
severity: normal
stage: needs patch
status: open
title: is_multipart and walk should document their treatment of 'message' parts.
versions: Python 2.7, Python 3.3, Python 3.4

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue18854>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to