Update error re-raising to use a more Python 2/3 compatible version.

This commit is contained in:
Adam Grant 2014-11-17 17:21:47 -08:00
parent 75d755a8fc
commit 2d9f5f906c

View File

@ -12,11 +12,13 @@ from __future__ import unicode_literals
from django.conf import settings
from django.http import QueryDict
from django.http.multipartparser import parse_header
from django.utils import six
from django.utils.datastructures import MultiValueDict
from rest_framework import HTTP_HEADER_ENCODING
from rest_framework import exceptions
from rest_framework.compat import BytesIO
from rest_framework.settings import api_settings
import sys
def is_form_media_type(media_type):
@ -226,7 +228,7 @@ class Request(object):
try:
self._authenticate()
except AttributeError as error:
raise RuntimeError("AttributeError: " + error.message)
six.reraise(RuntimeError, "AttributeError: " + str(error), sys.exc_info()[2])
return self._user
@user.setter