diff --git a/rest_framework/request.py b/rest_framework/request.py index 84ac9183c..281a43956 100644 --- a/rest_framework/request.py +++ b/rest_framework/request.py @@ -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