mirror of
https://github.com/python/cpython.git
synced 2025-08-04 17:08:35 +00:00
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.
This commit is contained in:
parent
0fae49fc7b
commit
0164b6bf22
1 changed files with 2 additions and 2 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue