From: Barry Warsaw Date: Mon, 15 Oct 2001 04:38:22 +0000 (+0000) Subject: typed_subpart_iterator(): When getting the main type use 'text' as the X-Git-Tag: v2.2.1c1~1288 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=0164b6bf227ca920af52608784f5c5605b6d3283;p=thirdparty%2FPython%2Fcpython.git typed_subpart_iterator(): When getting the main type use 'text' as the failobj, and when getting the subtype use 'plain' as the failobj. text/plain is supposed to be the default if the message contains no Content-Type: header. --- diff --git a/Lib/email/Iterators.py b/Lib/email/Iterators.py index d1ee53fe2d08..a64495d9b069 100644 --- a/Lib/email/Iterators.py +++ b/Lib/email/Iterators.py @@ -28,6 +28,6 @@ def typed_subpart_iterator(msg, maintype='text', subtype=None): omitted, only the main type is matched. """ for subpart in msg.walk(): - if subpart.get_main_type() == maintype: - if subtype is None or subpart.get_subtype() == subtype: + if subpart.get_main_type('text') == maintype: + if subtype is None or subpart.get_subtype('plain') == subtype: yield subpart