[Web-SIG] WSGI in standard library

Ian Bicking ianb at colorstudy.com
Thu Feb 16 23:46:54 CET 2006


Guido van Rossum wrote:
> At first I was going to respond "+1". But the fact that a couple of
> years haven't led to much suggests that it's unlikely to be fruitful;
> there just are too many diverging ideas on what is right. (Which makes
> sense since it's a huge and fast developing field.)
> 
> So unless someone (Alan Kennedy?) actually puts forward a PEP and gets
> it through a review of the major players on web-sig, I'm skeptical. I
> certainly don't want this potential effort to keep us from adding the
> low-hanging fruit (wsgiref, with perhaps some tweaks as PJE can manage
> based on recent feedback here) to the 2.5 stdlib.

What would we be PEPing?  wsgiref, for instance, could get a PEP. 
Should it have one?  If there was an HTTP server beyond what is in 
wsgiref now, should that have a PEP?

I one point I thought it would be too hard to come to agreement, but 
these days I think a request object would now be easy to define, with a 
constructor taking a WSGI environment, and just a couple attributes 
(params, cookies, environ, maybe headers, method, body).  In the 
standard library that could provide some utility, but since it would be 
strictly derivative of the WSGI environment it would not detract from 
anyone else's request object.  The request object would be limited to 
the information present in the WSGI environment, which simplifies the 
design process substantially.  I would not propose a response object.

I think a basic routing middleware (prefix-based URL match) would have 
some utility in concert with the HTTP server, both functional and 
educational.  Would people be interested in that?

Some current servers could be implemented as WSGI applications: 
CGIHTTPServer, SimpleHTTPServer, SimpleXMLRPCServer, DocXMLRPCServer. 
In each case the result would be substantially more useful than it is 
current, IMHO.  But it would also not be my first choice of 
functionality to implement, it's only that these parts are already in 
the standard library.

Some simple method to simulate a WSGI call would also be useful.  If 
other WSGI apps and middleware were included anywhere, I'd want to at 
least include such a simulation in the tests.

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


More information about the Web-SIG mailing list