[Twisted-web] Re: [Web-SIG] WSGI woes

Phillip J. Eby pje at telecommunity.com
Wed Sep 15 17:12:49 MDT 2004

At 06:48 PM 9/15/04 -0400, Peter Hunt wrote:
>It looks like WSGI is not well received over at twisted.web.

Excerpting from that post:

"""The WSGI spec is unsuitable for use with asynchronous servers and
applications. Basically, once the application callable returns, the
server (or "gateway" as wsgi calls it) must consider the page finished

This is incorrect.  Here is a simple WSGI application that demonstrates 
yielding 50 data blocks for transmission *after* the "application callable 

     def an_application(environ, start_response):
         start_response("200 OK", [('Content-Type','text/plain')])
         for i in range(1,51):
             yield "Block %d" % i

This has been a valid WSGI application since the August 8th posting of the 

It may be, however, that Mr. Preston means that applications which want to 
use 'write()' or a similar push-oriented approach to produce data cannot do 
so after the application returns.  If so, we should discuss that use case 
further, preferably on the Web-SIG.

>I thought the blocking call was handled by the iterator, but maybe I'm wrong.

I'm not sure what you mean, but if you're asking whether the iterable is 
allowed to create output blocks after the application callable returns, 
then yes.

More information about the Twisted-web mailing list