Django

Code

Ticket #4888 (closed: fixed)

Opened 1 year ago

Last modified 1 year ago

Fix Documentation: User authentication in Django

Reported by: Piotr Lewandowski <django@icomputing.biz> Assigned to: nobody
Milestone: Component: Documentation
Version: SVN Keywords: authentication
Cc: django@icomputing.biz Triage Stage: Ready for checkin
Has patch: 1 Needs documentation: 0
Needs tests: 0 Patch needs improvement: 0

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

authentication.txt.diff (1.4 kB) - added by Piotr Lewandowski <django@icomputing.biz> on 07/16/07 05:16:34.

Change History

07/16/07 05:16:34 changed by Piotr Lewandowski <django@icomputing.biz>

  • attachment authentication.txt.diff added.

07/16/07 05:20:17 changed by Piotr Lewandowski <django@icomputing.biz>

  • cc set to django@icomputing.biz.
  • needs_better_patch changed.
  • summary changed from Documentation: User authentication in Django fix to Fix Documentation: User authentication in Django.
  • needs_tests changed.
  • needs_docs changed.

08/20/07 04:34:03 changed by Simon G. <dev@simon.net.nz>

  • stage changed from Unreviewed to Ready for checkin.

09/14/07 21:49:50 changed by russellm

  • status changed from new to closed.
  • resolution set to wontfix.

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.

09/15/07 10:59:46 changed by Piotr Lewandowski <django@icomputing.biz>

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.

09/15/07 12:48:59 changed by adrian

  • resolution changed from wontfix to fixed.

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


Add/Change #4888 (Fix Documentation: User authentication in Django)




Change Properties
Action