[Web-SIG] PEP222 and python on the server?

Ian Bicking ianb at colorstudy.com
Thu Jun 9 20:41:52 CEST 2005

Hope you don't mind, I copied this bad to web-sig...

Iwan Vosloo wrote:
> I suppose you may be right.  Somehow we have gotten used to having "a
> request object" and "a response object".  And perhaps, in an
> absent-minded way we expect this sort of thing in another form than
> provided by the WSGI?  For example, I would prefer to query an object
> for something like req.headers['Content-Type'] (an expression close
> to the HTTP spec), and not work with a dictionary that uses a naming
> convention to do it (which feels one level removed from HTTP).
> Another: I'd prefer to have a response object I can pass around and
> add headers and whatever else to it - assuming that something will,
> when its time to send the thing, send everything in the right order,
> etc...
> Force of habit?

Well, no one is going to argue that WSGI give pretty objects to work 
with.  WSGI is very thorough and non-limiting.  It also avoids any 
discussion of mixed case vs. underscores, and other details which are 
hard to decide on, while also being quite unproductive.  I think of it 
as being aesthetically neutral.  There's some other useful aspects of it 
as well.

*But*, you shouldn't program directly to it, unless you are trying to be 
framework neutral (or maybe really low level), and even then it isn't 
always necessary.  So it's expected there should be wrappers; especially 
request wrappers, but response wrappers are also fine (but they do 
interupt the call sequence a little in comparison to request wrappers).

> Regarding the WSGI - are there plans to have an implementation of it
> in the standard library?

No, there aren't any plans.  I wasn't really sure what would go in the 
standard library, though now I'm thinking it would be really good to get 
some stuff in there.  In particular, I'd like to see SimpleHTTPServer 
extended to do WSGI, and a WSGI server added to cgi.  I don't know how 
practical it is to add new servers to the standard library, but the ones 
that are already there could definitely support it.  On the application 
side the cgi library mostly is sufficient, though it could probably use 
some relevant examples and documentation -- right now you have to read 
the source of that module to get the full FieldStorage signature.

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

More information about the Web-SIG mailing list