Opened 10 years ago

Closed 9 years ago

Last modified 8 years ago

#24126 closed Cleanup/optimization (fixed)

Consider deprecating the current_app argument of auth views

Reported by: Aymeric Augustin Owned by: lukawoj
Component: contrib.auth Version: dev
Severity: Normal Keywords: current_app
Cc: Triage Stage: Accepted
Has patch: yes Needs documentation: yes
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

All views defined in django.contrib.auth.views have the following structure:

def view(request, ..., current_app=None, ...):

    ...

    if current_app is not None:
        request.current_app = current_app

    return TemplateResponse(request, template_name, context)

As of Django 1.8 current_app is set on the request object. (This is debated but no other concrete proposal has been made at this time.)

For consistency the auth views should require the caller to set it on the request instead of passing it in a separate argument.

That would also avoid the risk of conflicts between a current_app set on the request and another current_app passed in argument. Currently the latter overrides the former.

Change History (8)

comment:1 by Tim Graham, 10 years ago

Triage Stage: UnreviewedAccepted

I guess the use case of making it a view parameter is that maybe you want to be able to simply use these views in a URLconf and specify the current_app that way? Further investigation is likely required.

comment:2 by Aymeric Augustin, 10 years ago

Keywords: current_app added; multiple-template-engines removed

comment:3 by lukawoj, 9 years ago

Owner: changed from nobody to lukawoj
Status: newassigned

comment:4 by lukawoj, 9 years ago

Has patch: set

comment:5 by Tim Graham, 9 years ago

Needs documentation: set

comment:6 by Tim Graham, 9 years ago

It looks like the use case for adding current_app was for the admin: cc64fb5c4b4315a4ad66e21458e27ece57266847.

If we automatically set the current_app as suggested in #24127, that would allow us to proceed with this deprecation without having to add request.current_app = request.resolver_match.namespace in all the admin callers in contrib/admin/sites.py.

comment:7 by Tim Graham <timograham@…>, 9 years ago

Resolution: fixed
Status: assignedclosed

In 927b30a:

Fixed #24126 -- Deprecated current_app parameter to auth views.

comment:8 by Tim Graham <timograham@…>, 8 years ago

In 9f9a3d64:

Refs #24126 -- Removed auth views' current_app parameter per deprecation timeline.

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