summaryrefslogtreecommitdiffstats
path: root/Lib/email/Parser.py
diff options
context:
space:
mode:
authorBarry Warsaw <barry@python.org>2002-09-10 16:14:56 (GMT)
committerBarry Warsaw <barry@python.org>2002-09-10 16:14:56 (GMT)
commit034b47acfe0f507cc4b1d8804272ca92d491d06e (patch)
treec47b3acfdeedc69ad42ceef741f70c62ada2f175 /Lib/email/Parser.py
parentb1c1de3805590f5f67ed2aedd9bd471c81cca011 (diff)
downloadcpython-034b47acfe0f507cc4b1d8804272ca92d491d06e.zip
cpython-034b47acfe0f507cc4b1d8804272ca92d491d06e.tar.gz
cpython-034b47acfe0f507cc4b1d8804272ca92d491d06e.tar.bz2
_parsebody(): Instead of raising a BoundaryError when no start
boundary could be found -- in a lax parser -- the entire body is assigned to the message payload.
Diffstat (limited to 'Lib/email/Parser.py')
-rw-r--r--Lib/email/Parser.py7
1 files changed, 5 insertions, 2 deletions
diff --git a/Lib/email/Parser.py b/Lib/email/Parser.py
index a2ac576..869ef16 100644
--- a/Lib/email/Parser.py
+++ b/Lib/email/Parser.py
@@ -135,8 +135,11 @@ class Parser:
r'(?P<sep>' + re.escape(separator) + r')(?P<ws>[ \t]*)',
payload)
if not mo:
- raise Errors.BoundaryError(
- "Couldn't find starting boundary: %s" % boundary)
+ if self._strict:
+ raise Errors.BoundaryError(
+ "Couldn't find starting boundary: %s" % boundary)
+ container.set_payload(payload)
+ return
start = mo.start()
if start > 0:
# there's some pre-MIME boundary preamble