]> granicus.if.org Git - python/commitdiff
typed_subpart_iterator(): When getting the main type use 'text' as the
authorBarry Warsaw <barry@python.org>
Mon, 15 Oct 2001 04:38:22 +0000 (04:38 +0000)
committerBarry Warsaw <barry@python.org>
Mon, 15 Oct 2001 04:38:22 +0000 (04:38 +0000)
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.

Lib/email/Iterators.py

index d1ee53fe2d0837c62340172ffdfbfc43d020fb3c..a64495d9b06919148eb7541c01c3b8927cbc10cd 100644 (file)
@@ -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