summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBarry Warsaw <barry@python.org>2002-07-09 02:39:07 (GMT)
committerBarry Warsaw <barry@python.org>2002-07-09 02:39:07 (GMT)
commit8fa06b55f6ea19bceed122620ae8f93487579de5 (patch)
treea39ffedd2d172688cc14ac6b7ba59a8e141f8b5a
parent329d3af4437656815f3e05e946171a016484b1ce (diff)
downloadcpython-8fa06b55f6ea19bceed122620ae8f93487579de5.zip
cpython-8fa06b55f6ea19bceed122620ae8f93487579de5.tar.gz
cpython-8fa06b55f6ea19bceed122620ae8f93487579de5.tar.bz2
_structure(): A handy little debugging aid that I don't (yet) intend
to make public, but that others might still find useful.
-rw-r--r--Lib/email/Iterators.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/Lib/email/Iterators.py b/Lib/email/Iterators.py
index a6ddceb..5253710 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)