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

Michael Hudson mwh@users.sourceforge.net
Mon, 28 Jan 2002 07:27:22 -0800


Update of /cvsroot/python/python/dist/src/Lib/email
In directory usw-pr-cvs1:/tmp/cvs-serv5169

Modified Files:
      Tag: release22-maint
	Parser.py 
Log Message:
It's merge time!

Backport bwarsaw's checkin of revision 1.6:

_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.5.10.1
diff -C2 -d -r1.5 -r1.5.10.1
*** Parser.py	2001/10/11 15:43:00	1.5
--- Parser.py	2002/01/28 15:27:20	1.5.10.1
***************
*** 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