mirror of
https://github.com/python/cpython.git
synced 2026-05-22 12:24:30 -04:00
4ef1c7d85b
type with get_type().
22 lines
625 B
Python
22 lines
625 B
Python
# Copyright (C) 2001,2002 Python Software Foundation
|
|
# Author: barry@zope.com (Barry Warsaw)
|
|
|
|
"""Various types of useful iterators and generators.
|
|
"""
|
|
|
|
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
|
|
|
|
|
|
|
|
def _structure(msg, level=0):
|
|
"""A handy debugging aid"""
|
|
tab = ' ' * (level * 4)
|
|
print tab + msg.get_type(msg.get_default_type())
|
|
if msg.is_multipart():
|
|
for subpart in msg.get_payload():
|
|
_structure(subpart, level+1)
|