@@ -211,7 +211,7 @@ def content_type(self):
211
211
meta = self ._request .META
212
212
return meta .get ('CONTENT_TYPE' , meta .get ('HTTP_CONTENT_TYPE' , '' ))
213
213
214
- @safe_property
214
+ @property
215
215
def stream (self ):
216
216
"""
217
217
Returns an object that may be used to stream the request content.
@@ -220,27 +220,29 @@ def stream(self):
220
220
self ._load_stream ()
221
221
return self ._stream
222
222
223
- @safe_property
223
+ @property
224
224
def query_params (self ):
225
225
"""
226
226
More semantically correct name for request.GET.
227
227
"""
228
228
return self ._request .GET
229
229
230
- @safe_property
230
+ @property
231
231
def data (self ):
232
232
if not _hasattr (self , '_full_data' ):
233
- self ._load_data_and_files ()
233
+ with wrap_attributeerrors ():
234
+ self ._load_data_and_files ()
234
235
return self ._full_data
235
236
236
- @safe_property
237
+ @property
237
238
def user (self ):
238
239
"""
239
240
Returns the user associated with the current request, as authenticated
240
241
by the authentication classes provided to the request.
241
242
"""
242
243
if not hasattr (self , '_user' ):
243
- self ._authenticate ()
244
+ with wrap_attributeerrors ():
245
+ self ._authenticate ()
244
246
return self ._user
245
247
246
248
@user .setter
@@ -256,14 +258,15 @@ def user(self, value):
256
258
self ._user = value
257
259
self ._request .user = value
258
260
259
- @safe_property
261
+ @property
260
262
def auth (self ):
261
263
"""
262
264
Returns any non-user authentication information associated with the
263
265
request, such as an authentication token.
264
266
"""
265
267
if not hasattr (self , '_auth' ):
266
- self ._authenticate ()
268
+ with wrap_attributeerrors ():
269
+ self ._authenticate ()
267
270
return self ._auth
268
271
269
272
@auth .setter
@@ -275,14 +278,15 @@ def auth(self, value):
275
278
self ._auth = value
276
279
self ._request .auth = value
277
280
278
- @safe_property
281
+ @property
279
282
def successful_authenticator (self ):
280
283
"""
281
284
Return the instance of the authentication instance class that was used
282
285
to authenticate the request, or `None`.
283
286
"""
284
287
if not hasattr (self , '_authenticator' ):
285
- self ._authenticate ()
288
+ with wrap_attributeerrors ():
289
+ self ._authenticate ()
286
290
return self ._authenticator
287
291
288
292
def _load_data_and_files (self ):
@@ -432,22 +436,24 @@ def __getattr__(self, attr):
432
436
except AttributeError :
433
437
raise AttributeError (f"'{ self .__class__ .__name__ } ' object has no attribute '{ attr } '" )
434
438
435
- @safe_property
439
+ @property
436
440
def POST (self ):
437
441
# Ensure that request.POST uses our request parsing.
438
442
if not _hasattr (self , '_data' ):
439
- self ._load_data_and_files ()
443
+ with wrap_attributeerrors ():
444
+ self ._load_data_and_files ()
440
445
if is_form_media_type (self .content_type ):
441
446
return self ._data
442
447
return QueryDict ('' , encoding = self ._request ._encoding )
443
448
444
- @safe_property
449
+ @property
445
450
def FILES (self ):
446
451
# Leave this one alone for backwards compat with Django's request.FILES
447
452
# Different from the other two cases, which are not valid property
448
453
# names on the WSGIRequest class.
449
454
if not _hasattr (self , '_files' ):
450
- self ._load_data_and_files ()
455
+ with wrap_attributeerrors ():
456
+ self ._load_data_and_files ()
451
457
return self ._files
452
458
453
459
def force_plaintext_errors (self , value ):
0 commit comments