From 2d9f5f906c46eaf37f441cad52274e0f00152273 Mon Sep 17 00:00:00 2001 From: Adam Grant Date: Mon, 17 Nov 2014 17:21:47 -0800 Subject: [PATCH] Update error re-raising to use a more Python 2/3 compatible version. --- rest_framework/request.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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