On Tue, 2006-07-11 at 21:34 -0700, Gary Wilson wrote:
> Thinking of this some more, I'm wondering about the names is_logged_in
> or is_authenticated.  They could be a little misleading since they
> aren't really checking if the user is logged in or not.  One might be
> led to believe that they could do something like logged_in_users =
> [user.is_logged_in() for user in User.objects.all()] or something like
> user = User.objects.get(username='fred');  if user.is_logged_in(): ...
> 
> It seems that maybe the is_anonymous function is just a way for the
> object to say it's either an AnonymousUser object or it's not an
> AnonymousUser object.

Hmm ... good points. We document is_anonymous() the way you describe it
in the last paragraph. In the same document, we use it in the slightly
accident-prone fashion your original post (and the thread on
django-users) described.

Considering alternatives in order of decreasing "stuipdness": one fix is
to make improvement in the documentation: "If you are going to put a
"members only" block of text up, you should check that user.id evaluates
as True." It is guaranteed that id == None on AnonymousUser objects.

Another possibility is to call the name "not_anonymous" (but not really
that name, since it's a pretty stupid name). Does "registered" work as a
name?

I guess I prefer finding a better name, rather than hoping for "success
through documentation".

Malcolm


--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to