[Python-checkins] python/dist/src/Lib/email Parser.py,1.20.4.2,1.20.4.3

anthonybaxter@users.sourceforge.net anthonybaxter@users.sourceforge.net
2003年6月12日 00:16:44 -0700


Update of /cvsroot/python/python/dist/src/Lib/email
In directory sc8-pr-cvs1:/tmp/cvs-serv13876
Modified Files:
 Tag: anthony-parser-branch
	Parser.py 
Log Message:
epilogue-processing is now the same as the old parser - the newline at the
end of the line with the --endboundary-- is included as part of the epilogue.
Note that any whitespace after the boundary is _not_ part of the epilogue.
Index: Parser.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/email/Parser.py,v
retrieving revision 1.20.4.2
retrieving revision 1.20.4.3
diff -C2 -d -r1.20.4.2 -r1.20.4.3
*** Parser.py	12 Jun 2003 06:39:09 -0000	1.20.4.2
--- Parser.py	12 Jun 2003 07:16:40 -0000	1.20.4.3
***************
*** 59,65 ****
 r = self.fp.read()
 if self.unread:
- self.unread.append(r)
 r = "\n".join(self.unread) + r
! self.unread = []
 return r
 
--- 59,64 ----
 r = self.fp.read()
 if self.unread:
 r = "\n".join(self.unread) + r
! self.unread = []
 return r
 
***************
*** 225,229 ****
 boundaryRE = re.compile(
 r'(?P<sep>' + re.escape(separator) + 
! r')(?P<end>--)?(?P<ws>[ \t]*)')
 preamble, matchobj = fp.readuntil(boundaryRE)
 if not matchobj:
--- 224,228 ----
 boundaryRE = re.compile(
 r'(?P<sep>' + re.escape(separator) + 
! r')(?P<end>--)?(?P<ws>[ \t]*)(?P<linesep>\r\n|\r|\n)$')
 preamble, matchobj = fp.readuntil(boundaryRE)
 if not matchobj:
***************
*** 270,274 ****
 if matchobj.group('end'):
 # That was the last piece of data. Let our caller attach
! # the epilogue to us.
 return container
 
--- 269,276 ----
 if matchobj.group('end'):
 # That was the last piece of data. Let our caller attach
! # the epilogue to us. But before we do that, push the
! # line ending of the match group back into the readline
! # buffer, as it's part of the epilogue.
! fp.unreadline(matchobj.group('linesep'))
 return container
 

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