request.user is dealt with in the middleware that comes with the auth
module.
http://code.djangoproject.com/browser/django/trunk/django/contrib/auth/middleware.py
> In LazyUser(object), the user instance is stored in
> request._cached_user
>
> In AuthenticationMiddleware(object), the user instance is stored in
> request.__class__.user
>
> But I don't see request.user being assigned at all. Where does that
> happen?
In LazyUser, when it calls the get_user function. Using request.user in
your code will call __get__ on the LazyUser instance, and it'll actually
get the real User instance via the get_user function (unless it's
already cached, of course).
Shawn