Update of /cvsroot/python/python/dist/src/Lib/email In directory usw-pr-cvs1:/tmp/cvs-serv28371/Lib/email Modified Files: Parser.py Log Message: _parsebody(): Use get_content_type() instead of the deprecated get_type(). Also, one of the regular expressions is constant so might as well make it a module global. And, when splitting up digests, handle lineseps that are longer than 1 character in length (e.g. \r\n). Index: Parser.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/email/Parser.py,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** Parser.py 30 Sep 2002 20:07:22 -0000 1.16 --- Parser.py 7 Oct 2002 17:27:35 -0000 1.17 *************** *** 21,24 **** --- 21,26 ---- False = 0 + nlcre = re.compile('\r\n|\r|\n') + *************** *** 138,142 **** # boundary if present. boundary = container.get_boundary() ! isdigest = (container.get_type() == 'multipart/digest') # If there's a boundary, split the payload text into its constituent # parts and parse each separately. Otherwise, just parse the rest of --- 140,144 ---- # boundary if present. boundary = container.get_boundary() ! isdigest = (container.get_content_type() == 'multipart/digest') # If there's a boundary, split the payload text into its constituent # parts and parse each separately. Otherwise, just parse the rest of *************** *** 168,173 **** # Find out what kind of line endings we're using start += len(mo.group('sep')) + len(mo.group('ws')) ! cre = re.compile('\r\n|\r|\n') ! mo = cre.search(payload, start) if mo: start += len(mo.group(0)) --- 170,174 ---- # Find out what kind of line endings we're using start += len(mo.group('sep')) + len(mo.group('ws')) ! mo = nlcre.search(payload, start) if mo: start += len(mo.group(0)) *************** *** 210,219 **** for part in parts: if isdigest: ! if part[0] == linesep: # There's no header block so create an empty message # object as the container, and lop off the newline so # we can parse the sub-subobject msgobj = self._class() ! part = part[1:] else: parthdrs, part = part.split(linesep+linesep, 1) --- 211,220 ---- for part in parts: if isdigest: ! if part.startswith(linesep): # There's no header block so create an empty message # object as the container, and lop off the newline so # we can parse the sub-subobject msgobj = self._class() ! part = part[len(linesep):] else: parthdrs, part = part.split(linesep+linesep, 1)
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4