[Web-SIG] Re: The rewritten WSGI pre-PEP

Ian Bicking ianb at colorstudy.com
Wed Aug 11 17:54:36 CEST 2004


Fredrik Lundh wrote:
> Disadvantages:
> - one more argument; but if that's really a problem, why not make
>   start_response a method of the context class?
> 
>         def application(context, environ):
>             ...
>             context.start(status, headers)

This would solve the too-many-callables problem as well.

However, because the context could have a complex implementation, it 
would be hard to rewrite the context if you forward the request.  OTOH, 
most of the pieces of the context shouldn't be forwarded on.  For 
instance, if mod_python gives access to the apache module, or the 
original request object, should middleware pass through that access?  It 
would probably be incorrect, as the middleware is doing some filtering 
and the mod_python extensions would bypass that filtering.

Which is to say, middleware shouldn't pass through extensions by 
default, but with a dictionionary implementation it would be common to 
do so.

One positive aspect of a dictionary is that introspection is easier. 
There's no reliable equivalent of .keys() for an arbitrary object.

And, if we package things into an object, environ could also become an 
attribute of context.


-- 
Ian Bicking  /  ianb at colorstudy.com  /  http://blog.ianbicking.org


More information about the Web-SIG mailing list