#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
---------------------------------+------------------------------------
Changes (by Carlton Gibson):

 * severity:  Normal => Release blocker
 * stage:  Unreviewed => Accepted


Comment:

 >> There is no proper public documentation so these are sort of internals
 that are sometimes used in projects. Do we really want to make this
 officially public API?

 Grrr. I think it's
 [https://github.com/search?l=Python&q=_cached_user&type=Code more that
 sometimes...]. 😬

 The user has been cached on the request here for 13 years.
 3c5782287efc197eccf556cf6915fc0d8b3e02bd. I think it we just move it we
 will see a large number of "You broke my site" reports. (So whatever we do
 we have to accept this as a Release Blocker on 3.1 no?)

 The saving here is a function call (into the lambda to fetch the cached
 value). I don't think that's worth the disruption, even to deprecate.

 Maybe adding an ''Official Getterâ„¢'' is worthwhile.  (If we had such, an
 eventual deprecation of `_cached_user` might be on, but even then...)

 For better or worse there's a good amount of this kind of API that we say
 is private, but is used by lots of projects out there, and that we can't
 realistically change.

 > Also do we really want to guarantee that request.user is actually
 LazyObject?

 Exactly this. Custom middleware's leveraging `_cached_user` but not
 setting a `user` that has `_wrapped` property... (and so on).

 I think we should probably revert 2f010795e690550c8c6f56b3924c0f629cacb33b
 — but are the other options really feasible?

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

Reply via email to