From: Barry Warsaw Date: Tue, 9 Jul 2002 02:39:07 +0000 (+0000) Subject: _structure(): A handy little debugging aid that I don't (yet) intend X-Git-Tag: v2.3c1~5081 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=8fa06b55f6ea19bceed122620ae8f93487579de5;p=python _structure(): A handy little debugging aid that I don't (yet) intend to make public, but that others might still find useful. --- diff --git a/Lib/email/Iterators.py b/Lib/email/Iterators.py index a6ddceb053..5253710dee 100644 --- a/Lib/email/Iterators.py +++ b/Lib/email/Iterators.py @@ -9,3 +9,13 @@ try: 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)