if part.get_content_maintype() != 'text':
continue
- #print "\t%s, %s" % \
- # (part.get_content_subtype(), part.get_content_charset())
+ payload = part.get_payload(decode=True)
+ subtype = part.get_content_subtype()
- charset = part.get_content_charset()
- if not charset:
- charset = mail.get_charset()
- if not charset:
- charset = 'utf-8'
-
- payload = unicode(part.get_payload(decode=True), charset, "replace")
-
- if part.get_content_subtype() == 'x-patch':
+ if subtype in ['x-patch', 'x-diff']:
patchbuf = payload
- if part.get_content_subtype() == 'plain':
+ elif subtype == 'plain':
if not patchbuf:
(patchbuf, c) = parse_patch(payload)
else: