Code

Opened 8 years ago

Closed 8 years ago

#2388 closed defect (fixed)

[patch]login_required decorator in contrib.auth doesn't preserve doc string or dict of decorated function.

Reported by: derekgr@… Owned by: adrian
Component: Contrib apps Version: master
Severity: minor Keywords:
Cc: Triage Stage: Unreviewed
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:

Description

Functions decorated with django.contrib.auth's login_required decorator don't inherit the name, doc, or dict attributes of the functions they decorate.

The login_required decorator returns an inner function, so I would expect that it would simply set the attributes accordingly. In fact, a patch is applied which does exactly that.

In this way examining methods in the shell makes it more transparent that a decorator is applied and allows developer documentation strings to percolate past the decoration.

Attachments (1)

decorators.py.diff (574 bytes) - added by derekgr@… 8 years ago.
Patch to decorators.py.

Download all attachments as: .zip

Change History (3)

Changed 8 years ago by derekgr@…

Patch to decorators.py.

comment:1 Changed 8 years ago by derekgr@…

  • Summary changed from login_required decorator in contrib.auth doesn't preserve doc string or dict of decorated function. to [patch]login_required decorator in contrib.auth doesn't preserve doc string or dict of decorated function.

comment:2 Changed 8 years ago by adrian

  • Resolution set to fixed
  • Status changed from new to closed

(In [3461]) Fixed #2388 -- login_required decorator now preserves docstring and name of decorated function. Thanks, derekgr@…

Add Comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
as The resolution will be set. Next status will be 'closed'
The resolution will be deleted. Next status will be 'new'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.