[Python-checkins] CVS: python/dist/src/Lib/email Parser.py,1.5,1.6

Barry Warsaw bwarsaw@users.sourceforge.net
2002年1月26日 22:48:04 -0800


Update of /cvsroot/python/python/dist/src/Lib/email
In directory usw-pr-cvs1:/tmp/cvs-serv22837
Modified Files:
	Parser.py 
Log Message:
_parsebody(): When adding subparts to a multipart container, make sure
that the first subpart added makes the payload a list object.
Otherwise, a multipart/* with only one subpart will not have the
proper structure.
Index: Parser.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/email/Parser.py,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** Parser.py	2001年10月11日 15:43:00	1.5
--- Parser.py	2002年01月27日 06:48:02	1.6
***************
*** 1,3 ****
! # Copyright (C) 2001 Python Software Foundation
 # Author: barry@zope.com (Barry Warsaw)
 
--- 1,3 ----
! # Copyright (C) 2001,2002 Python Software Foundation
 # Author: barry@zope.com (Barry Warsaw)
 
***************
*** 6,9 ****
--- 6,10 ----
 
 from cStringIO import StringIO
+ from types import ListType
 
 # Intrapackage imports
***************
*** 134,138 ****
 container.preamble = preamble
 container.epilogue = epilogue
! container.add_payload(msgobj)
 elif container.get_type() == 'message/delivery-status':
 # This special kind of type contains blocks of headers separated
--- 135,143 ----
 container.preamble = preamble
 container.epilogue = epilogue
! # Ensure that the container's payload is a list
! if not isinstance(container.get_payload(), ListType):
! container.set_payload([msgobj])
! else:
! container.add_payload(msgobj)
 elif container.get_type() == 'message/delivery-status':
 # This special kind of type contains blocks of headers separated

AltStyle によって変換されたページ (->オリジナル) /