Skip to content

Commit 2d9f5f9

Browse files
committed
Update error re-raising to use a more Python 2/3 compatible version.
1 parent 75d755a commit 2d9f5f9

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

rest_framework/request.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,13 @@
1212
from django.conf import settings
1313
from django.http import QueryDict
1414
from django.http.multipartparser import parse_header
15+
from django.utils import six
1516
from django.utils.datastructures import MultiValueDict
1617
from rest_framework import HTTP_HEADER_ENCODING
1718
from rest_framework import exceptions
1819
from rest_framework.compat import BytesIO
1920
from rest_framework.settings import api_settings
21+
import sys
2022

2123

2224
def is_form_media_type(media_type):
@@ -226,7 +228,7 @@ def user(self):
226228
try:
227229
self._authenticate()
228230
except AttributeError as error:
229-
raise RuntimeError("AttributeError: " + error.message)
231+
six.reraise(RuntimeError, "AttributeError: " + str(error), sys.exc_info()[2])
230232
return self._user
231233

232234
@user.setter

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy