[Web-SIG] [ANN] twsgi: asynchronous WSGI implementation for Twisted Web

Manlio Perillo manlio_perillo at libero.it
Fri Apr 9 14:46:17 CEST 2010


Graham Dumpleton ha scritto:
> On 9 April 2010 22:15, Manlio Perillo <manlio_perillo at libero.it> wrote:
>> Graham Dumpleton ha scritto:
>>> [...]
>>>> But since the write callable **can** be implemented in a middleware
>>>> (using greenlets) and since middlewares *can* be configured inside WSGI
>>>> gateway, implementations can still claim to be WSGI 1.0 conformant.
>>> Then only the higher level middleware adapter can even claim to be
>>> WSGI compliant and deserve to use the WSGI name.
>> Since the middleware is executed inside WSGI gateway, and the gateway
>> can be configured to always execute some middleware, the final
>> application will simply have at disposal a WSGI conformant write callable.
> 
> Then it isn't really a middleware at all then, but a part of your
> overall solution.

It is just that the gateway has support to direct execution of
middlewares, since this make the implementation more flexible.

> So long as only the complete solution is exposed and
> is WSGI compliant then fine. But if it is going to be layered in any
> way such that lower level layers can be used in their own right, then
> the lower level layers shouldn't really be said to be WSGI if they
> don't implement full WSGI specification. As much as we all have our
> complaints about WSGI specification, it is what it is and is all we
> have right now.
> 

By the way, as a matter of curiosity.
WSGI 1.0 states:

"""The start_response callable must return a write(body_data) callable
that takes one positional parameter: a string to be written as part of
the HTTP response body. (Note: the write() callable is provided only to
support certain existing frameworks' imperative output APIs; it should
not be used by new applications or frameworks if it can be avoided. See
the Buffering and Streaming section for more details.)"""


There is nothing that prevents the write callable to raise an exception.

Of course an implementation that always raise a NotImplementedError is
going to be useless (for applications that require the write callable),
but it seems to me that such an implementation can still claim to
conform to WSGI 1.0.

> [...]

Manlio


More information about the Web-SIG mailing list