Opened 17 years ago

Closed 17 years ago

Last modified 17 years ago

#4888 closed (fixed)

Fix Documentation: User authentication in Django

Reported by: Piotr Lewandowski <django@…> 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)

authentication.txt.diff (1.4 KB ) - added by Piotr Lewandowski <django@…> 17 years ago.

Download all attachments as: .zip

Change History (6)

by Piotr Lewandowski <django@…>, 17 years ago

Attachment: authentication.txt.diff added

comment:1 by Piotr Lewandowski <django@…>, 17 years ago

Cc: django@… added
Summary: Documentation: User authentication in Django fixFix Documentation: User authentication in Django

comment:2 by Simon G. <dev@…>, 17 years ago

Triage Stage: UnreviewedReady for checkin

comment:3 by Russell Keith-Magee, 17 years ago

Resolution: wontfix
Status: newclosed

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.

comment:4 by Piotr Lewandowski <django@…>, 17 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 Adrian Holovaty, 17 years ago

Resolution: wontfixfixed

(In [6297]) Fixed #4888 -- Fixed small confusion in docs/authentication.txt. Thanks, Piotr Lewandowski

Note: See TracTickets for help on using tickets.
Back to Top