[Python-checkins] python/dist/src/Lib/email Iterators.py,1.9,1.10
bwarsaw@users.sourceforge.net
bwarsaw@users.sourceforge.net
Fri, 19 Jul 2002 15:21:49 -0700
Update of /cvsroot/python/python/dist/src/Lib/email
In directory usw-pr-cvs1:/tmp/cvs-serv7257/email
Modified Files:
Iterators.py
Log Message:
_structure(): Take an optional `fp' argument which would be the object
to print>> the structure to. Defaults to sys.stdout.
Index: Iterators.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/email/Iterators.py,v
retrieving revision 1.9
retrieving revision 1.10
diff -C2 -d -r1.9 -r1.10
*** Iterators.py 11 Jul 2002 20:24:36 -0000 1.9
--- Iterators.py 19 Jul 2002 22:21:47 -0000 1.10
***************
*** 5,8 ****
--- 5,10 ----
"""
+ import sys
+
try:
from email._compat22 import body_line_iterator, typed_subpart_iterator
***************
*** 13,21 ****
! 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)
--- 15,25 ----
! def _structure(msg, level=0, fp=None):
"""A handy debugging aid"""
+ if fp is None:
+ fp = sys.stdout
tab = ' ' * (level * 4)
! print >> fp, tab + msg.get_type(msg.get_default_type())
if msg.is_multipart():
for subpart in msg.get_payload():
! _structure(subpart, level+1, fp)