Opened 13 years ago
Closed 13 years ago
#16636 closed Bug (wontfix)
Wording in documentation for contrib.auth could be improved on is_authenticated()
Reported by: | cyclops | Owned by: | nobody |
---|---|---|---|
Component: | contrib.auth | Version: | 1.3 |
Severity: | Normal | Keywords: | |
Cc: | Triage Stage: | Unreviewed | |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | yes | UI/UX: | no |
Description
https://docs.djangoproject.com/en/1.3/topics/auth/#django.contrib.auth.models.User.is_authenticated
starts with the text:
"Always returns True. This is a way to tell if the user has been authenticated. "
I really hope it doesn't always return True. :)
A better wording might be:
"Returns True if the user has been properly authenticated."
This (and related ticket #16635) have really been bugging me for a while, I finally had to post a ticket. :)
Change History (4)
comment:1 by , 13 years ago
Resolution: | → wontfix |
---|---|
Status: | new → closed |
comment:2 by , 13 years ago
Then the text is still seriously confusing... When I use the following code in a view:
def order_worked(request): print "user = ", request.user.is_authenticated()
and I am not logged in to my application (never entered a login/password), the view prints:
user = False
When I log in, the view prints:
user = True
Based on the other ticket's explanation, you're saying that the User object is really two different objects - but that doesn't change the fact that calling the function is_authenticated(), returns two different values. :)
Maybe my wording is incorrect, but there must be some other wording that more accurately describes what is going on.
comment:3 by , 13 years ago
Resolution: | wontfix |
---|---|
Status: | closed → reopened |
I'm not clear on the protocol for replies - does the person closing a ticket, get notified of replies? I'm re-opening the ticket in case they don't - apologies if I'm not supposed to re-open things :)
comment:4 by , 13 years ago
Resolution: | → wontfix |
---|---|
Status: | reopened → closed |
https://docs.djangoproject.com/en/1.3/internals/contributing/#reporting-bugs describes some do's and don't regarding tickets, one don't involves reopening tickets closed wontfix. In this case I'd suggest posting on django-users for continued explanation; I can't spend a lot of time on this right now due to work commitments. The doc is correct. The key thing you seem to be missing is that request.user
is sometimes an actual django.contrib.auth.models.User instance and sometimes an AnonymousUser
instance. This could perhaps be described better in the doc somewhere, but the current doc is technically correct, and to change it as suggested would be incorrect since in fact a contrib.auth User model will never return other values than what is documented for is_anonymous and is_authenticated.
It does always return True. See #16635 for additional explanation.