#9913: authentication method docs wrong or confusing WRT returned value
-------------------------------+------------------------------------
     Reporter:  ptone          |                    Owner:  nobody
         Type:  New feature    |                   Status:  new
    Component:  Documentation  |                  Version:  master
     Severity:  Normal         |               Resolution:
     Keywords:                 |             Triage Stage:  Accepted
    Has patch:  0              |      Needs documentation:  0
  Needs tests:  0              |  Patch needs improvement:  0
Easy pickings:  0              |                    UI/UX:  0
-------------------------------+------------------------------------

Comment (by rshea):

 How about leaving `is_anonymous()` in its current form:

  is_anonymous()::
     Always returns False. This is a way of differentiating User and
 AnonymousUser
     objects. Generally, you should prefer using is_authenticated() to this
 method.

 and revising `is_authenticated()` to emphasize that it simply checks the
 type of object inserted into `request.user` within views by the
 `AuthenticationMiddleware` as recommended by gwilson.  Perhaps:

  is_authenticated()::
     Always returns True. Contrast this with
 `AnonymousUser.is_authenticated()`, which
     always returns False.  This is a way to tell if the user has been
 authenticated.
     This does not imply any permissions, and doesn't check if the user is
 active - it
     only indicates that the `request.user` object within the view has been
 populated by
     the `AuthenticationMiddleware` with a User object representing the
 currently logged-
     in user.

 I'm not completely happy with this revised definition of
 `is_authenticated()` due to the verbose phrasing around `request.user`,
 but I do think this is a more precise definition of what the function is
 doing.

-- 
Ticket URL: <https://code.djangoproject.com/ticket/9913#comment:5>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to