[Python-checkins] python/dist/src/Lib/email FeedParser.py,1.6,1.7

bwarsaw at users.sourceforge.net bwarsaw at users.sourceforge.net
Thu May 13 16:17:54 EDT 2004


Update of /cvsroot/python/python/dist/src/Lib/email
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3223

Modified Files:
	FeedParser.py 
Log Message:
readline(): RFC 2046, section 5.1.2 (and partially 5.1) both state that the
parser must recognize outer boundaries in inner parts.  So cruise through the
EOF stack backwards testing each predicate against the current line.

There's still some discussion about whether this is (always) the best thing to
do.  Anthony would rather parse these messages as if the outer boundaries were
ignored.  I think that's counter to the RFC, but might be practically more
useful.  Can you say behavior flag?  (ug).


Index: FeedParser.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/email/FeedParser.py,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -d -r1.6 -r1.7
*** FeedParser.py	11 May 2004 22:23:59 -0000	1.6
--- FeedParser.py	13 May 2004 20:17:51 -0000	1.7
***************
*** 72,78 ****
          # false-EOF predicate.
          line = self._lines.pop()
!         if self._eofstack:
!             matches = self._eofstack[-1]
!             if matches(line):
                  # We're at the false EOF.  But push the last line back first.
                  self._lines.append(line)
--- 72,80 ----
          # false-EOF predicate.
          line = self._lines.pop()
!         # RFC 2046, section 5.1.2 requires us to recognize outer level
!         # boundaries at any level of inner nesting.  Do this, but be sure it's
!         # in the order of most to least nested.
!         for ateof in self._eofstack[::-1]:
!             if ateof(line):
                  # We're at the false EOF.  But push the last line back first.
                  self._lines.append(line)




More information about the Python-checkins mailing list