[Web-SIG] Sketching a WSGI 2-to-1 adapter with greenlets

Ian Bicking ianb at colorstudy.com
Sat Sep 19 02:40:01 CEST 2009


On Fri, Sep 18, 2009 at 7:09 PM, Armin Ronacher
<armin.ronacher at active-4.com> wrote:
> Ian Bicking schrieb:
>> What's wrong with this simpler approach to the conversion?
> It buffers, you can no longer do this:
>
>   request.write('processing data')
>   request.flush()
>   ...
>   request.write('data processed')
>   request.flush()
>
> But that's not too common and people should rather rewrite their
> applications to use generators for these cases.

Yes -- I don't think many (any?) people use this particular technique,
though many people use the start_response writer simply because it was
there and it seemed like a good idea.  I even used it a few times
because it was easier to code for some circumstances (e.g.,
paste.cgiapp) but not because I expected it would immediately be
pushed to the client.  (appengine's webapp framework uses it a lot,
not entirely sure why; not for streaming though -- maybe because it
pushes the bytes out of the Python interpreter and into the parent
process faster)

So, I'm just saying we need to handle the start_response writer,
because people have used it, but I'm not aware of people using it for
its intended purpose.

-- 
Ian Bicking  |  http://blog.ianbicking.org  |  http://topplabs.org/civichacker


More information about the Web-SIG mailing list