[Web-SIG] WSGI and start_response

P.J. Eby pje at telecommunity.com
Thu Apr 8 17:20:44 CEST 2010


At 04:59 PM 4/8/2010 +0200, Manlio Perillo wrote:
>Aaron Watters ha scritto:
> > someone remind me: where is the canonical WSGI 2 spec?
>
>http://wsgi.org/wsgi/WSGI_2.0
>
> > I assume there is a way to "wrap" WSGI 1 applications
> > without breaking them?  Or is this the regex-->re fiasco
> > all over again?
> >
>
>start_response can be implemented by a function that will store the
>status code and response headers.
>
>There should be a sample WSGI 2.0 implementation for CGI, and a sample
>WSGI 1.0 -> 2.0 adapter.
>
>This adapter should be able to support the coroutine example,
> > http://paste.pocoo.org/show/199202/
>but I would like to test.
>
>write callable, as far as I know, can not be implemented.

Implementing it requires greenlets or threads, but it's implementable.  See:

http://mail.python.org/pipermail/web-sig/2009-September/003986.html

(Btw, I've noticed that this early sketch of mine doesn't support the 
case where an application is a generator, because start_response 
won't have been called when the application returns.  This can be 
fixed, but it requires the addition of a wrapper class and a few 
other annoying details.  It also doesn't support exc_info properly, 
so it's still a ways from being a correct WSGI 1 server 
implementation.  Getting rid of all these little variations, though, 
is the goal of having a WSGI 2 - it's difficult to write *any* 
middleware to be completely WSGI 1 compliant.)



More information about the Web-SIG mailing list