Package wsgitools :: Module middlewares :: Class ContentLengthMiddleware
[hide private]
[frames] | no frames]

Class ContentLengthMiddleware

source code

Guesses the content length header if possible.


Note: The application used must not use the write callable returned by start_response.

Instance Methods [hide private]
 
__init__(self, app, maxstore=0)
Wraps wsgi application app.
source code
 
__call__(self, environ, start_response)
wsgi interface
source code
Method Details [hide private]

__init__(self, app, maxstore=0)
(Constructor)

source code 

Wraps wsgi application app. It can also store the first result bytes to possibly return a list of strings which will make guessing the size of iterators possible. At most maxstore bytes will be accumulated. Please note that a value larger than 0 will violate the wsgi standard. The magical value () will make it always gather all data.

Parameters:
  • maxstore (int or ())