Opened 10 years ago

Closed 10 years ago

#21483 closed New feature (fixed)

[RFE] Add WSGI environ to request_started signal emission

Reported by: jag@… Owned by: anonymous
Component: Core (Other) Version: dev
Severity: Normal Keywords:
Cc: Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: yes
Easy pickings: no UI/UX: no

Description

As written, the request_started signal cannot take into account any of the specifics of the aforementioned request in a connected handler. The signal provided args should add the WSGI environ to the emitted signal to allow connected handlers to act related to the request's context.

Pull request provided here: https://github.com/django/django/pull/1951

Change History (7)

comment:1 by Unai Zalakain, 10 years ago

Needs documentation: set
Needs tests: set
Triage Stage: UnreviewedAccepted

Suggestions noted on the PR! Assign this ticket to yourself if you are planning to work on it ;-)

comment:2 by Joshua "jag" Ginsberg <jag@…>, 10 years ago

Owner: changed from nobody to anonymous
Status: newassigned

comment:3 by Joshua "jag" Ginsberg <jag@…>, 10 years ago

PR amended with suggestions. Thanks!

comment:4 by Aymeric Augustin, 10 years ago

I'm wondering if whatever you're planning to do in the signal receiver wouldn't be better implemented in a middleware.

But maybe that's just my phobia of signals :)

comment:5 by Joshua "jag" Ginsberg <jag@…>, 10 years ago

For many (most?) cases, I'd agree with you - middleware has that explicitness, where as signals are automated magic. However the signal is the absolute earliest place to modify the handling of a request - for cases where middleware may even be too late, doing work with a signal handler could be the best option.

comment:6 by Tim Graham, 10 years ago

Needs documentation: unset
Needs tests: unset
Patch needs improvement: set

I left comments for improvement on the PR. Please uncheck "Patch needs improvement" when you update it, thanks.

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

Resolution: fixed
Status: assignedclosed

In eb2af16c59c3014541e2ad8ca63e510bc076dd8b:

Fixed #21483 -- Added WSGI environ to kwargs sent to request_started signal.

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