Ticket #18481: 18481-2.patch

File 18481-2.patch, 1.3 KB (added by André Cruz, 12 years ago)

New patch that uses the standard raise format

  • django/http/request.py

    diff --git a/django/http/request.py b/django/http/request.py
    index a8eb14d..1221ade 100644
    a b class HttpRequest(object):  
    183183            try:
    184184                self._body = self.read()
    185185            except IOError as e:
    186                 six.reraise(UnreadablePostError, UnreadablePostError(*e.args), sys.exc_info()[2])
     186                six.reraise(UnreadablePostError, UnreadablePostError(*tuple(e.args)), sys.exc_info()[2])
    187187            self._stream = BytesIO(self._body)
    188188        return self._body
    189189
    class HttpRequest(object):  
    234234
    235235    def read(self, *args, **kwargs):
    236236        self._read_started = True
    237         return self._stream.read(*args, **kwargs)
     237        try:
     238            return self._stream.read(*args, **kwargs)
     239        except IOError as e:
     240            six.reraise(UnreadablePostError, UnreadablePostError(*tuple(e.args)), sys.exc_info()[2])
    238241
    239242    def readline(self, *args, **kwargs):
    240243        self._read_started = True
    241         return self._stream.readline(*args, **kwargs)
     244        try:
     245            return self._stream.readline(*args, **kwargs)
     246        except IOError as e:
     247            six.reraise(UnreadablePostError, UnreadablePostError(*tuple(e.args)), sys.exc_info()[2])
    242248
    243249    def xreadlines(self):
    244250        while True:
Back to Top