Re: WSGI2: write callable?

Benoit Chesneau <[email protected]> Fri, 26 Sep 2014 22:26:04 +0200
Newsgroups gmane.comp.python.web
Message-ID <CAJNb-9o3MCGeJgwZv40yy7rkD5QzUXuZ0=zzULR5W8feegCCsg@mail.gmail.com>
On Fri, Sep 26, 2014 at 9:58 PM, PJ Eby <pje-Wh6+Hckhi6HFNGf7iClzIwC/[email protected]> wrote:

> On Thu, Sep 25, 2014 at 11:32 PM, Robert Collins
> <[email protected]> wrote:
> > So I propose we drop the write callable, and include a queue based
> > implementation in the adapter for PEP-3333 code.
>
> If you're dropping write(), then you might as well drop
> start_response() altogether, and replace it with returning a (status,
> headers, body-iterator) tuple, as in wsgi_lite (
> https://github.com/pjeby/wsgi_lite ) or as found in other languages'
> versions of WSGI.  (start_response+write was only ever needed in order
> to support legacy apps, so other languages never bothered.)
>
> wsgi_lite has a couple of other protocol extensions, namely the
> 'wsgi_lite.closing' environment key, flagging callables' supported
> WSGI version (for transparent interop), and the argument binding
> protocol, but for the most part these are orthogonal to the calling
> schema.  I would suggest, however, that the calling protocol be
> flagged in some way to allow easier interop.
>

I quite like the idea of always returning an iterator for the body it would
simplify the code a lot...

About returning the status and other thing, I quite agree, but imo we also
need to return an extra parameter where the application or the middleware
could maintain a state or something like it. Thoughts?

- benoit


> _______________________________________________
> Web-SIG mailing list
> [email protected]
> Web SIG: http://www.python.org/sigs/web-sig
> Unsubscribe:
> https://mail.python.org/mailman/options/web-sig/bchesneau%40gmail.com
>

_______________________________________________
Web-SIG mailing list
[email protected]
Web SIG: http://www.python.org/sigs/web-sig
Unsubscribe: https://mail.python.org/mailman/options/web-sig/gcpw-web-sig%40m.gmane.org