#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
---------------------------------+--------------------------------------
Description changed by CarlosMirdeSouza:
Old description:
> Before https://github.com/django/django/commit/2f01079, it was possible
> to check to see whether the lazy user has been evaluated or not using
> `hasattr(request, '_cached_user')`.
>
> This was undocumented, but I think we should try to maintain backwards
> compatibility for that that check, and document and test it for the
> future. (Or if nothing else, document and test how to do this the new way
> and add a release note about the change.)
>
> This is really helpful in middleware to be able to check whether the user
> has been evaluated, so you can access the user if it has already been
> accessed, but can avoid fetching user if it hasn't already been fetched.
New description:
Before https://github.com/django/django/commit/2f01079, it was possible to
check to see whether the lazy user has been evaluated or not using
`hasattr(request, '_cached_user')`.
This was undocumented, but I think we should try to maintain backwards
compatibility for that check, and document and test it for the future. (Or
if nothing else, document and test how to do this the new way and add a
release note about the change.)
This is really helpful in middleware to be able to check whether the user
has been evaluated, so you can access the user if it has already been
accessed, but can avoid fetching user if it hasn't already been fetched.
--
--
Ticket URL: <https://code.djangoproject.com/ticket/30941#comment:8>
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.58473488ad5b038a12069d0872931d4e%40djangoproject.com.