[Web-SIG] Proposal: Avoiding Serialization When Stacking Middleware
Robert Brewer
fumanchu at amor.org
Wed Mar 7 04:23:17 CET 2007
Ian Bicking wrote:
> This proposal gives a strategy for avoiding unnecessary
> serialization and deserialization of request and response
> bodies. It does so by attaching attributes to ``wsgi.input``
> and the ``app_iter``, as well as a new environment key
> ``x-wsgiorg.want_parsed_response``.
>
> [snip]
>
> for item in app_iter:
> written_output.append(item)
This bit of the example, at least, is not compliant with PEP 333:
http://www.python.org/dev/peps/pep-0333/#middleware-handling-of-block-boundaries
"To put this requirement another way, a middleware component
must yield at least one value each time its underlying
application yields a value. If the middleware cannot yield
any other value, it must yield an empty string."
I suspect rewriting the example to conform to PEP 333 will make this proposal much more complex?
Robert Brewer
System Architect
Amor Ministries
fumanchu at amor.org
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/web-sig/attachments/20070306/28095a2d/attachment-0001.htm
More information about the Web-SIG
mailing list