Comment 1 for bug 873030

Revision history for this message
Robert Collins (lifeless) wrote :

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:)