#30941: hasattr(request, '_cached_user') check no longer works
---------------------------------+--------------------------------------
Reporter: Collin Anderson | Owner: nobody
Type: Bug | Status: new
Component: contrib.auth | Version: master
Severity: Normal | Resolution:
Keywords: | Triage Stage: Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
---------------------------------+--------------------------------------
Changes (by Simon Charette):
* cc: Sergey Fedoseev, Simon Charette (added)
Comment:
If we wanted to deprecate this behavior we could add a `_cached_user`
descriptor to `request` that raises a deprecation warning on access and
raises an `AttributeError` when `instance.user._wrapped is empty`.
FWIW I'd much prefer we define a blessed way of looking this up then
maintaining compatibility with this implementation specific `_cached_user`
hack.
Something like `request.user.loaded` by subclassing `SimpleLazyObject` or
adding this feature directly `LazyObject` sounds more reasonable to me.
--
Ticket URL: <https://code.djangoproject.com/ticket/30941#comment:4>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/072.1ae218509f93af4232ae23f6446d1dc6%40djangoproject.com.