[Web-SIG] Python and the web

David Fraser davidf at sjsoft.com
Fri Oct 24 03:48:36 EDT 2003


Michael C. Neel wrote:

>	For a http server module, this is not a great need for myself
>but it would still be good to have.  My idea would be a server class
>that you derived a server from, overriding the phases of the request you
>needed to work with, al'a the way Apache works.  Something like:
>
>class MyServer(HTTPServer):
>
>	def authhandler(self, req):
>		if self.validate(req.user, req.pass):
>			return true
>		else:
>			return false
>
>	def handler(self, req):
>		page = req.uri.filename
>		try:
>			req.send(open(page,'r').read())
>			return true
>		execpt:
>			return false
>
>	That's basic, but if you've worked with the apache API in
>mod_python, mod_perl, or C you get the idea.  Also it would be nice if
>the default handlers provided a working server, if some options were set
>like a DocumentRoot:
>
>class MyServer(HTTPServer):
>	documentroot = "/var/www/html"
>  
>
I think this architecture is great... but obviously people coming from a 
non-Apache background may have other ideas.
However, the key is defining the request/response system well, and then 
multiple different server structures could be built on that

>	I would say that Apache's 1.3 API should be a better goal, and
>leave out the new features in 2.0 API.  First is the KISS principle,
>next is we should be trying to replace Apache but rather provide a
>reasonable useful web server in the stdlib.  Also, if someone needs a
>feature of the 2.0 style API, they can always add that in the derived
>class.
>  
>
On the other hand, the 2.0 API is an improvement of the 1.3 API, and 
allows things like Filters etc which would be great to include.

David




More information about the Web-SIG mailing list