summaryrefslogtreecommitdiff
path: root/django/http/multipartparser.py
diff options
context:
space:
mode:
authorkonarkmodi <modi.konark@gmail.com>2013-03-19 10:34:59 +0530
committerCarl Meyer <carl@oddbird.net>2013-03-19 15:42:39 -0700
commitbc4111ba68e5eede1f68882a16d68441a845e30b (patch)
tree0b7689470b8ff28cdaee5fbe5053b81c720fd497 /django/http/multipartparser.py
parent1fe90b281baa1601e4582fd9454b92740e527d89 (diff)
downloaddjango-bc4111ba68e5eede1f68882a16d68441a845e30b.tar.gz
Fixed #18003 -- Preserved tracebacks when re-raising errors.
Thanks jrothenbuhler for draft patch, Konark Modi for updates.
Diffstat (limited to 'django/http/multipartparser.py')
-rw-r--r--django/http/multipartparser.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/django/http/multipartparser.py b/django/http/multipartparser.py
index 070874f234..0c07335f27 100644
--- a/django/http/multipartparser.py
+++ b/django/http/multipartparser.py
@@ -8,6 +8,7 @@ from __future__ import unicode_literals
import base64
import cgi
+import sys
from django.conf import settings
from django.core.exceptions import SuspiciousOperation
@@ -209,7 +210,8 @@ class MultiPartParser(object):
chunk = base64.b64decode(chunk)
except Exception as e:
# Since this is only a chunk, any error is an unfixable error.
- raise MultiPartParserError("Could not decode base64 data: %r" % e)
+ msg = "Could not decode base64 data: %r" % e
+ six.reraise(MultiPartParserError, MultiPartParserError(msg), sys.exc_info()[2])
for i, handler in enumerate(handlers):
chunk_length = len(chunk)