Skip to content

Commit 22ec160

Browse files
author
Ryan P Kilby
committed
Do not hide request auth attribute errors
1 parent 4c29776 commit 22ec160

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

rest_framework/request.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -380,6 +380,11 @@ def __getattribute__(self, attr):
380380
try:
381381
return super(Request, self).__getattribute__(attr)
382382
except AttributeError:
383+
# Do not proxy attribute access for `user` and `auth`, as this
384+
# potentially hides AttributeError's raised in `_authenticate`.
385+
if attr in ['user', 'auth']:
386+
raise
387+
383388
info = sys.exc_info()
384389
try:
385390
return getattr(self._request, attr)

0 commit comments

Comments
 (0)