Opened 11 years ago

Closed 11 years ago

Last modified 11 years ago

#6699 closed (invalid)

contrib.auth decorators aren't using proper decorator syntax

Reported by: Chris Beaven Owned by: nobody
Component: Contrib apps Version: master
Severity: Keywords:
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no


The related documentation ( is totally incorrect. Neither of the 2.3 or 2.4 decoration methods stated will work:

my_view = login_required(redirect_field_name='redirect_to')(my_view)

since the definition is:

def login_required(function=None, redirect_field_name=REDIRECT_FIELD_NAME):

Other decorator methods in this are also wrong.

Change History (3)

comment:1 Changed 11 years ago by Chris Beaven

#6700, has a possible solution.

comment:2 Changed 11 years ago by Malcolm Tredinnick

Resolution: invalid
Status: newclosed

This is mistaken. Notice that login_required behaves differently based on whether function is passed in or not: one case returns a decorator (function=None), the other returns the decorated function.

comment:3 Changed 11 years ago by Chris Beaven

Duh... I typed this up while answering an IRC problem without obviously looking too closely at the code. Sorry for the noise, Malcolm.

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