IBodyProducer isn't supported with twisted wsgi stacks
Bug #873030 reported by
Robert Collins
This bug affects 1 person
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
python-oops-twisted |
Fix Released
|
High
|
Robert Collins |
Bug Description
U1, which would like to use oops-wsgi in a twisted wsgi stack, have an extension where they can return an IBodyProducer rather than a generator, which gets put back into the event loop rather than tying up a thread. That is interfered with by the OOPS middleware as it currently stands.
Related branches
lp://staging/~lifeless/python-oops-twisted/bug-873030
- Stuart Bishop (community): Approve
-
Diff: 629 lines (+513/-0)10 files modified.bzrignore (+1/-0)
.testr.conf (+4/-0)
NEWS (+3/-0)
README (+19/-0)
oops_twisted/__init__.py (+37/-0)
oops_twisted/tests/__init__.py (+1/-0)
oops_twisted/tests/test_wsgi.py (+297/-0)
oops_twisted/wsgi.py (+149/-0)
setup.py (+1/-0)
versions.cfg (+1/-0)
Changed in python-oops-twisted: | |
assignee: | nobody → Robert Collins (lifeless) |
Changed in python-oops-twisted: | |
status: | Triaged → Fix Released |
To post a comment you must log in.
This is I think the needed contract:
- app() returns something
- headers may or may not have been sent
- that thing is direct-iterable or async iterable via IBodyProducer
- we want to run some oops-wsgi code when:
- first bytes are gotten (unbuffer headers, timeout based oopses)
- end of stream (unbuffer headers)
- an exception is raised (but not in the gateway code)
- if nothing has been sent this will want to inject/return data.
So we need a parameterisable wrapper for the result from app()
And a small number of callbacks (3) which the wrapper needs to reliably call
I will start by refactoring oops-wsgi itself to have the needed extension point and this structure internally. Then will write an IBodyProducer wrapper. Then we see how badly I messed it up:)