mirror of
https://github.com/encode/django-rest-framework.git
synced 2025-08-05 04:50:12 +03:00
Update error re-raising to use a more Python 2/3 compatible version.
This commit is contained in:
parent
75d755a8fc
commit
2d9f5f906c
|
@ -12,11 +12,13 @@ from __future__ import unicode_literals
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from django.http import QueryDict
|
from django.http import QueryDict
|
||||||
from django.http.multipartparser import parse_header
|
from django.http.multipartparser import parse_header
|
||||||
|
from django.utils import six
|
||||||
from django.utils.datastructures import MultiValueDict
|
from django.utils.datastructures import MultiValueDict
|
||||||
from rest_framework import HTTP_HEADER_ENCODING
|
from rest_framework import HTTP_HEADER_ENCODING
|
||||||
from rest_framework import exceptions
|
from rest_framework import exceptions
|
||||||
from rest_framework.compat import BytesIO
|
from rest_framework.compat import BytesIO
|
||||||
from rest_framework.settings import api_settings
|
from rest_framework.settings import api_settings
|
||||||
|
import sys
|
||||||
|
|
||||||
|
|
||||||
def is_form_media_type(media_type):
|
def is_form_media_type(media_type):
|
||||||
|
@ -226,7 +228,7 @@ class Request(object):
|
||||||
try:
|
try:
|
||||||
self._authenticate()
|
self._authenticate()
|
||||||
except AttributeError as error:
|
except AttributeError as error:
|
||||||
raise RuntimeError("AttributeError: " + error.message)
|
six.reraise(RuntimeError, "AttributeError: " + str(error), sys.exc_info()[2])
|
||||||
return self._user
|
return self._user
|
||||||
|
|
||||||
@user.setter
|
@user.setter
|
||||||
|
|
Loading…
Reference in New Issue
Block a user