[Web-SIG] Defining a standard interface for common web tasks

David Fraser davidf at sjsoft.com
Thu Oct 23 02:19:56 EDT 2003


Ian Bicking wrote:

> On Friday, October 17, 2003, at 03:51 PM, Bill Janssen wrote:
>
>> 1)  A good CGI module.  This should allow clear access to the various
>> values passed in the environment, as Simon points out.  I think the
>> current "cgi" module isn't bad at this, but I'm sure we can find
>> shortcomings.
>
> There's a bunch of shortcomings -- some of which aren't that big a 
> deal in the CGI environment (like adding headers) but make cgi-based 
> programs difficult to port to other systems.
>
>> 2) A standard Apache plug-in.  Does mod_python fill this role?  (Should
>> this really be part of the stdlib?)  It would be useful if the APIs
>> used here were similar to those used in the API support.
>
> mod_python pretty much fits this.  I don't see any reason to develop 
> anything else (at least in terms of Apache integration).  I don't 
> think it would make sense as part of the stdlib -- it depends on 
> Apache just as much as Python, and people install Apache in all sorts 
> of different ways.

Yes, in Apache, mod_python is pretty much it. As far as the API goes, I 
think mod_python is an important one to look at at the design stage 
rather than trying to fit an API to it later, since Apache is fairly 
standard and mod_python is used by lots of different people. You don't 
want mod_python to have to be rewritten to comply with the API later.

>> 3)  A standard stand-alone solution, but better than the three standard
>> servers already in the stdlib.  I been using Medusa lately, and rather
>> like its approach to things.
>
>
> Twisted makes as much sense as anything.  My impression is that Medusa 
> is similar, but Twisted is more actively developed.  OTOH, Twisted is 
> moving out into other things -- some well defined portion of Twisted 
> could be included, but certainly not everything that is distributed 
> with Twisted currently.  There are also some Twistedisms, like 
> Deferred, which are generic but not currently used by much of anyone 
> outside Twisted.
>
> Medusa is nice because it has a limited scope.  But that's good and 
> bad.  Twisted would work great if the Twisted people wanted to make a 
> small defined core, and it wouldn't work well otherwise.

I haven't used Medusa, but I have used Twisted and the standard Python 
libraries.
Some notes:
1) Twisted is definitely too complex to include. The question is, would 
it be possible to rip out a simple web server from Twisted or would it 
require a whole lot of extras that don't fit in the standard libraries? 
This may amount to a re-write.
2) Actually, having something really simple with limited functionality 
is great, particularly if it uses a standard API that more complex 
servers support. This would allow people to develop/test/install with 
just the basic Python libraries. I actually think the standard servers 
would be fine if they were cleaned up and extended a bit.
3) It's important to define what basic functionality will be required by 
the API, and what extra functionality will be defined by it. I would 
suggest the following:
- url handling
- get/post argument support, in standard dictionaries
- cookie support, in standard dictionaries
- flexible request/response support

David




More information about the Web-SIG mailing list