Opened 16 months ago

Closed 7 months 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: master
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 Changed 16 months ago by unaizalakain

  • Needs documentation set
  • Needs tests set
  • Patch needs improvement unset
  • Triage Stage changed from Unreviewed to Accepted

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

comment:2 Changed 16 months ago by Joshua "jag" Ginsberg <jag@…>

  • Owner changed from nobody to anonymous
  • Status changed from new to assigned

comment:3 Changed 16 months ago by Joshua "jag" Ginsberg <jag@…>

PR amended with suggestions. Thanks!

comment:4 Changed 16 months ago by aaugustin

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 Changed 16 months ago by Joshua "jag" Ginsberg <jag@…>

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 Changed 8 months ago by timgraham

  • 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 Changed 7 months ago by Tim Graham <timograham@…>

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

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