Opened 9 years ago

Closed 9 years ago

Last modified 9 years ago

#24188 closed Cleanup/optimization (wontfix)

Update django.contrib.auth.decorators.py

Reported by: Anton Antonov Owned by: nobody
Component: contrib.auth Version: 1.7
Severity: Normal Keywords:
Cc: Triage Stage: Unreviewed
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

Having a default login_url of settings.LOGIN_URL is a bit more explicit and readable than giving it a default value of None and later in _wrapped_view resolving the login_url or settings.LOGIN_URL if the first was none.

login_required and permission_required don't really need to be changed, but it's better for consistency.

Addressed in https://github.com/django/django/pull/3959

Change History (3)

comment:1 by Claude Paroz, 9 years ago

I guess the current code is written that way to prevent accessing settings at import time, as settings should be kept lazy as much as possible.

comment:2 by Tim Graham, 9 years ago

Resolution: wontfix
Status: newclosed

I agree with Claude and don't see much advantage to changing it, especially as it seems to cause many test failures. e74edb4d53b089ec57ec4830eeba98607283a092 is version before the current version where settings was also imported only if needed.

comment:3 by Anton Antonov, 9 years ago

Alright.

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