On 9/11/06, Joseph Kocherhans <[EMAIL PROTECTED]> wrote: > On 9/11/06, Ivan Sagalaev <[EMAIL PROTECTED]> wrote: > > > > I've just found out that request.user is an attribute of request's class > > not of an instance. Which means that in the environment with multiple > > requests (threaded or not) every request.user always points to a single > > LazyUser instance which is obviously a bad thing. What was the reason > > for this decision? > > It may look like a class attribute, but it's not. LazyUser has > overridden __get__, so request.user is a descriptor, not a plain old > attibute. It *must* be assigned to the class, and not an instance, or > __get__ will not be called. You can google python descriptors for more > info.
Hmm... looking into this more, Ivan was right... kind of (and maybe this is what he meant, but it's not how I read it, sorry if I misunderstood). I did a simplified descriptor test and found that the current code *does* act more or less like a class attribute. I've created a new ticket with a patch that fixes the problem. The cached user is currently stored as an attribute of LazyUser, but should be stored as an attribute of the request. http://code.djangoproject.org/ticket/2702 Joseph --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django developers" group. To post to this group, send email to django-developers@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-developers -~----------~----~----~----~------~----~------~--~---