_structure(): A handy little debugging aid that I don't (yet) intend

to make public, but that others might still find useful.
This commit is contained in:
Barry Warsaw 2002-07-09 02:39:07 +00:00
parent 329d3af443
commit 8fa06b55f6

View file

@ -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)