diff Lib/email/Iterators.py @ 24149:7bcd8177628f legacy-trunk

_structure(): A handy little debugging aid that I don't (yet) intend to make public, but that others might still find useful.
author Barry Warsaw <barry@python.org>
date Tue, 09 Jul 2002 02:39:07 +0000
parents 077d44b0405b
children 774dc07f1c16
line wrap: on
line diff
--- a/Lib/email/Iterators.py	Tue Jul 09 02:38:24 2002 +0000
+++ b/Lib/email/Iterators.py	Tue Jul 09 02:39:07 2002 +0000
@@ -9,3 +9,13 @@
 except SyntaxError:
     # Python 2.1 doesn't have generators
     from email._compat21 import body_line_iterator, typed_subpart_iterator
+
+
+
+def _structure(msg, level=0):
+    """A handy debugging aid"""
+    tab = ' ' * (level * 4)
+    print tab + msg.get('content-type', msg.get_default_type())
+    if msg.is_multipart():
+        for subpart in msg.get_payload():
+            _structure(subpart, level+1)