I have been working on solving #25847 (making User.is_authenticated a
property), and in the process I was wondering whether we want to keep
User.is_anonymous at all in the long run.

My reasoning is:

- the documentation makes it quite clear you should use
request.user.is_authenticated instead of request.user.is_anonymous

- there is no guarantee that request.user.is_authenticated !=
request.user.is_anonymous. This means a custom user model could make a
User both anonymous and authenticated (or neither) and we would end up
with rather surprising results depending on how authentication is
checked (using is_authenticated or is_anonymous).

Do we know of any custom user models with this unconventional behaviour?

Incidentally I found there is only one place were we django uses
.is_anonymous internally : django.contrib.auth.backends.ModelBackend,
all other places use user.is_authenticated as recommended in the
documentation.

Thanks in advance for your insights!
Jeremy

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers  (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/django-developers.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-developers/56FFB849.9010800%40m4x.org.
For more options, visit https://groups.google.com/d/optout.

Reply via email to