[Python-checkins] python/dist/src/Lib/email FeedParser.py,1.4,1.5
bwarsaw at users.sourceforge.net
bwarsaw at users.sourceforge.net
Tue May 11 16:19:13 EDT 2004
Update of /cvsroot/python/python/dist/src/Lib/email
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28747
Modified Files:
FeedParser.py
Log Message:
_parsegen(): Move the message/rfc822 clause to after the
message/delivery-status clause, and genericize it to handle all (other)
message/* content types. This lets us correctly parse 2 more of Anthony's
MIME torture tests (specifically, the message/external-body examples).
Index: FeedParser.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/email/FeedParser.py,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** FeedParser.py 11 May 2004 18:10:15 -0000 1.4
--- FeedParser.py 11 May 2004 20:19:09 -0000 1.5
***************
*** 212,230 ****
self._cur.set_payload(EMPTYSTRING.join(lines))
return
- # So now the input is sitting at the first body line. If the message
- # claims to be a message/rfc822 type, then what follows is another RFC
- # 2822 message.
- if self._cur.get_content_type() == 'message/rfc822':
- for retval in self._parsegen():
- if retval is NeedMoreData:
- yield NeedMoreData
- continue
- break
- self._pop_message()
- return
if self._cur.get_content_type() == 'message/delivery-status':
# message/delivery-status contains blocks of headers separated by
# a blank line. We'll represent each header block as a separate
! # nested message object. A blank line separates the subparts.
while True:
self._input.push_eof_matcher(NLCRE.match)
--- 212,221 ----
self._cur.set_payload(EMPTYSTRING.join(lines))
return
if self._cur.get_content_type() == 'message/delivery-status':
# message/delivery-status contains blocks of headers separated by
# a blank line. We'll represent each header block as a separate
! # nested message object, but the processing is a bit different
! # than standard message/* types because there is no body for the
! # nested messages. A blank line separates the subparts.
while True:
self._input.push_eof_matcher(NLCRE.match)
***************
*** 250,253 ****
--- 241,254 ----
self._input.unreadline(line)
return
+ if self._cur.get_content_maintype() == 'message':
+ # The message claims to be a message/* type, then what follows is
+ # another RFC 2822 message.
+ for retval in self._parsegen():
+ if retval is NeedMoreData:
+ yield NeedMoreData
+ continue
+ break
+ self._pop_message()
+ return
if self._cur.get_content_maintype() == 'multipart':
boundary = self._cur.get_boundary()
More information about the Python-checkins
mailing list