|
12 | 12 | from django.conf import settings
|
13 | 13 | from django.http import QueryDict
|
14 | 14 | from django.http.multipartparser import parse_header
|
| 15 | +from django.utils import six |
15 | 16 | from django.utils.datastructures import MultiValueDict
|
16 | 17 | from django.utils.datastructures import MergeDict as DjangoMergeDict
|
17 |
| -from django.utils.six import BytesIO |
18 | 18 | from rest_framework import HTTP_HEADER_ENCODING
|
19 | 19 | from rest_framework import exceptions
|
20 | 20 | from rest_framework.settings import api_settings
|
@@ -363,7 +363,7 @@ def _load_stream(self):
|
363 | 363 | elif hasattr(self._request, 'read'):
|
364 | 364 | self._stream = self._request
|
365 | 365 | else:
|
366 |
| - self._stream = BytesIO(self.raw_post_data) |
| 366 | + self._stream = six.BytesIO(self.raw_post_data) |
367 | 367 |
|
368 | 368 | def _perform_form_overloading(self):
|
369 | 369 | """
|
@@ -405,7 +405,7 @@ def _perform_form_overloading(self):
|
405 | 405 | self._CONTENTTYPE_PARAM in self._data
|
406 | 406 | ):
|
407 | 407 | self._content_type = self._data[self._CONTENTTYPE_PARAM]
|
408 |
| - self._stream = BytesIO(self._data[self._CONTENT_PARAM].encode(self.parser_context['encoding'])) |
| 408 | + self._stream = six.BytesIO(self._data[self._CONTENT_PARAM].encode(self.parser_context['encoding'])) |
409 | 409 | self._data, self._files, self._full_data = (Empty, Empty, Empty)
|
410 | 410 |
|
411 | 411 | def _parse(self):
|
@@ -498,4 +498,4 @@ def __getattribute__(self, attr):
|
498 | 498 | try:
|
499 | 499 | return getattr(self._request, attr)
|
500 | 500 | except AttributeError:
|
501 |
| - raise info[0], info[1], info[2].tb_next |
| 501 | + six.reraise(info[0], info[1], info[2].tb_next) |
0 commit comments