2002-04-10 18:01:31 -03:00
|
|
|
|
# Copyright (C) 2001,2002 Python Software Foundation
|
2001-09-23 00:17:28 -03:00
|
|
|
|
# Author: barry@zope.com (Barry Warsaw)
|
|
|
|
|
|
|
|
|
|
"""Various types of useful iterators and generators.
|
|
|
|
|
"""
|
|
|
|
|
|
2002-07-19 19:21:47 -03:00
|
|
|
|
import sys
|
|
|
|
|
|
2002-05-19 20:44:19 -03:00
|
|
|
|
try:
|
|
|
|
|
from email._compat22 import body_line_iterator, typed_subpart_iterator
|
|
|
|
|
except SyntaxError:
|
|
|
|
|
# Python 2.1 doesn't have generators
|
|
|
|
|
from email._compat21 import body_line_iterator, typed_subpart_iterator
|
2002-07-08 23:39:07 -03:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2002-07-19 19:21:47 -03:00
|
|
|
|
def _structure(msg, level=0, fp=None):
|
2002-07-08 23:39:07 -03:00
|
|
|
|
"""A handy debugging aid"""
|
2002-07-19 19:21:47 -03:00
|
|
|
|
if fp is None:
|
|
|
|
|
fp = sys.stdout
|
2002-07-08 23:39:07 -03:00
|
|
|
|
tab = ' ' * (level * 4)
|
2002-09-01 18:04:43 -03:00
|
|
|
|
print >> fp, tab + msg.get_content_type()
|
2002-07-08 23:39:07 -03:00
|
|
|
|
if msg.is_multipart():
|
|
|
|
|
for subpart in msg.get_payload():
|
2002-07-19 19:21:47 -03:00
|
|
|
|
_structure(subpart, level+1, fp)
|