#4888 closed (fixed)
Fix Documentation: User authentication in Django
| Reported by: | Owned by: | nobody | |
|---|---|---|---|
| Component: | Documentation | Version: | dev |
| Severity: | Keywords: | authentication | |
| Cc: | django@… | Triage Stage: | Ready for checkin |
| Has patch: | yes | Needs documentation: | no |
| Needs tests: | no | Patch needs improvement: | no |
| Easy pickings: | no | UI/UX: | no |
Description
In http://www.djangoproject.com/documentation/authentication/#writing-an-authentication-backend we read:
An authentication backend is a class that implements two methods: ``get_user(id)`` and ``authenticate(**credentials)``. The ``get_user`` method takes an ``id`` -- which could be a username, database ID or whatever -- and returns a ``User`` object.
Meanwhile...
$ svn cat django/contrib/auth/backends.py | grep get_user
def get_user(self, user_id):
Additionaly code below may suggest it is complete backend class while it doesn't have get_user() method.
class MyBackend: def authenticate(self, username=None, password=None): # Check the username/password and return a User.
Attachments (1)
Change History (6)
by , 18 years ago
| Attachment: | authentication.txt.diff added |
|---|
comment:1 by , 18 years ago
| Cc: | added |
|---|---|
| Summary: | Documentation: User authentication in Django fix → Fix Documentation: User authentication in Django |
comment:2 by , 18 years ago
| Triage Stage: | Unreviewed → Ready for checkin |
|---|
comment:3 by , 18 years ago
| Resolution: | → wontfix |
|---|---|
| Status: | new → closed |
comment:4 by , 18 years ago
I can't see the reason why the documentation should be buggy. It clearly states that get_user takes an id whereas it actually takes user_id.
Don't you think that's oversight? You just referred to the second part of this ticket.
comment:5 by , 18 years ago
| Resolution: | wontfix → fixed |
|---|
Note:
See TracTickets
for help on using tickets.
I'm not sure I see the value in these changes -- the existing text is accurate (in that it describes the methods they way they are used on a class), and provides a sample wrapper class for explanatory purposes. The proposed patch removes the explanatory context, but add the 'self' method to the examples. I think the existing text is much clearer.