[Python-checkins] python/dist/src/Lib/email _compat21.py,1.5,1.6
bwarsaw@users.sourceforge.net
bwarsaw@users.sourceforge.net
Mon, 10 Mar 2003 20:41:20 -0800
Update of /cvsroot/python/python/dist/src/Lib/email
In directory sc8-pr-cvs1:/tmp/cvs-serv30655
Modified Files:
_compat21.py
Log Message:
body_line_iterator(): Accept optional decode argument, pass through to
Message.get_payload().
Index: _compat21.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/email/_compat21.py,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** _compat21.py 24 Dec 2002 18:31:27 -0000 1.5
--- _compat21.py 11 Mar 2003 04:41:18 -0000 1.6
***************
*** 38,46 ****
# These two functions are imported into the Iterators.py interface module.
# The Python 2.2 version uses generators for efficiency.
! def body_line_iterator(msg):
! """Iterate over the parts, returning string payloads line-by-line."""
lines = []
for subpart in msg.walk():
! payload = subpart.get_payload()
if _isstring(payload):
for line in StringIO(payload).readlines():
--- 38,49 ----
# These two functions are imported into the Iterators.py interface module.
# The Python 2.2 version uses generators for efficiency.
! def body_line_iterator(msg, decode=False):
! """Iterate over the parts, returning string payloads line-by-line.
!
! Optional decode (default False) is passed through to .get_payload().
! """
lines = []
for subpart in msg.walk():
! payload = subpart.get_payload(decode=decode)
if _isstring(payload):
for line in StringIO(payload).readlines():