On Thursday, February 23, 2012 10:41:36 AM UTC-5, Tom Evans wrote: I don't like this function that much. > I share that sentiment. When it becomes possible to refactor auth.User, I hope we'll be able to first deprecate and then remove User.is_authenticated() and User.is_anonymous(). In addition to the point you raised (that these methods don't actually test that the user has in fact authenticated), there is also the possible source of confusion stemming from the fact that in template language we write:
{% if user.is_authenticated %} but in Python we write: if user.is_authenticated(): You could easily get used to writing it the first way if you do a lot of template development, and then accidentally write it that way when you switch back to Python: if user.is_authenticated: which will happily and quietly always evaluate to True. Perhaps the presence of a user object on the request object ought to be enough to indicate that a user has authenticated. If so, maybe AnonymousUser could be retired. Cheers, Clay -- You received this message because you are subscribed to the Google Groups "Django developers" group. To view this discussion on the web visit https://groups.google.com/d/msg/django-developers/-/oqia2g66GLQJ. To post to this group, send email to django-developers@googlegroups.com. To unsubscribe from this group, send email to django-developers+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-developers?hl=en.