[Web-SIG] Middleware stack construction

David Fraser davidf at sjsoft.com
Tue Sep 12 11:12:51 CEST 2006


We've been trying to manage how we handle the middleware stack in our
web framework. The PEP doesn't specify any standard way of doing this
and the example is constructed with the next item in the stack as a

Our approach is to pass a WSGIStack variable in the environment
variables and get each layer of middleware to pop off the next layer and
call it, thus:

def run_child(self, environ, startresponse):
    child = environ["j5_WSGIStack"].pop()
    return child(environ, startresponse)

so that the middleware can transform that in whichever way it wants...

Does this fit in well with how other people are doing things? Just curious


More information about the Web-SIG mailing list