bpo-42892: fix email multipart attribute error (GH-26903)

This commit is contained in:
andrei kulakov 2021-07-30 13:05:49 -04:00 committed by GitHub
parent 4bd9caafb6
commit e3f877c32d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 36 additions and 3 deletions

View file

@ -982,7 +982,7 @@ class MIMEPart(Message):
if subtype in preferencelist:
yield (preferencelist.index(subtype), part)
return
if maintype != 'multipart':
if maintype != 'multipart' or not self.is_multipart():
return
if subtype != 'related':
for subpart in part.iter_parts():
@ -1087,7 +1087,7 @@ class MIMEPart(Message):
Return an empty iterator for a non-multipart.
"""
if self.get_content_maintype() == 'multipart':
if self.is_multipart():
yield from self.get_payload()
def get_content(self, *args, content_manager=None, **kw):