summaryrefslogtreecommitdiff
path: root/django/http/request.py
diff options
context:
space:
mode:
authorClaude Paroz <claude@2xlibre.net>2013-06-01 10:26:46 +0200
committerClaude Paroz <claude@2xlibre.net>2013-06-01 10:26:46 +0200
commitde66b56790598f2ff97b8df859356d755ce64e20 (patch)
tree5a91cdf2e4c8f6543f23bf1d2ec8ca20543a5ffd /django/http/request.py
parent369b6fab25b55ceb363ba2a8cb7e0f1a88ef8f8d (diff)
Fixed #18481 -- Wrapped request.FILES read error in UnreadablePostError
Thanks KyleMac for the report, André Cruz for the initial patch and Hiroki Kiyohara for the tests.
Diffstat (limited to 'django/http/request.py')
-rw-r--r--django/http/request.py10
1 files changed, 8 insertions, 2 deletions
diff --git a/django/http/request.py b/django/http/request.py
index e6811aa6cc..37aa1a355a 100644
--- a/django/http/request.py
+++ b/django/http/request.py
@@ -238,11 +238,17 @@ class HttpRequest(object):
def read(self, *args, **kwargs):
self._read_started = True
- return self._stream.read(*args, **kwargs)
+ try:
+ return self._stream.read(*args, **kwargs)
+ except IOError as e:
+ six.reraise(UnreadablePostError, UnreadablePostError(*e.args), sys.exc_info()[2])
def readline(self, *args, **kwargs):
self._read_started = True
- return self._stream.readline(*args, **kwargs)
+ try:
+ return self._stream.readline(*args, **kwargs)
+ except IOError as e:
+ six.reraise(UnreadablePostError, UnreadablePostError(*e.args), sys.exc_info()[2])
def xreadlines(self):
while True: