#30941: hasattr(request, '_cached_user') check no longer works
---------------------------------+------------------------------------
     Reporter:  Collin Anderson  |                    Owner:  nobody
         Type:  Bug              |                   Status:  new
    Component:  contrib.auth     |                  Version:  master
     Severity:  Release blocker  |               Resolution:
     Keywords:                   |             Triage Stage:  Accepted
    Has patch:  0                |      Needs documentation:  0
  Needs tests:  0                |  Patch needs improvement:  0
Easy pickings:  0                |                    UI/UX:  0
---------------------------------+------------------------------------

Comment (by Carlton Gibson):

 So, [https://github.com/iguzu/appengine-
 
helper/blob/208ed9145b2bb15d53c6ad3519fe85d775b9edee/appengine_django/auth/middleware.py
 example from the first page].

 If I'm then checking, as Collin suggested for `_cached_user` as a way of
 avoiding a lookup, that use will break. But so would a fallback to
 `user._wrapped`, because the custom ''lazy user'' in play doesn't work the
 way our lazy object does.

 If we move the user cache from the request, we break a lot of
 expectations, but, more, we tie that cache into the internal
 implementation of `LazyObject`. (I took that to be the force of your
 objection to making `request.user` have to be a `LazyObject` — currently
 folks can (and do) set whatever they like... — is that not what you
 meant?)

-- 
Ticket URL: <https://code.djangoproject.com/ticket/30941#comment:11>
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.52fd2e97d6059b40c5177b77962298d9%40djangoproject.com.

Reply via email to