jamwt/diesel — pull request #30 by dowski (2012-03-15 19:45:23+00:00)
Title: Streaming WSGI

This change adds efficient streaming support to diesel2's WSGI implementation. The previous version consumed the result from the `wsgi_callable` and stuffed it into a list. This version streams the parts of the result out using `send`.

There are a couple cases where the result is not streamed. First, if there is no `Content-Length` header supplied. Second, if the entire `wsgi_callable` is a generator it has to be flattened to set headers and such.

Just make sure your `wsgi_callable` *returns* a generator, and you can stream.