Against the CGI-is-slow chorus (Re: CGI with Python: advantages?)

Michael Ströder michael at stroeder.com
Mon Aug 7 09:38:30 EDT 2000


HI!

I also agree that CGI-BINs does their jobs quite well most times.
I want to add something to the discussion:

If you want to write some CGI-BINs now you will be able to
let them run as stand-alone server or
name-your-favourite-web-persistence-module-here if you write
them with some basic guide-lines in mind:

- encapsulate the request handler in a function
- use file object parameters for input and output, a dictionary 
parameter for the OS environment (module cgi already is capable
doing that)
- keep an eye on thread-safe programming
- your modules should not rely on being reset every hit

Following these guide-lines it's very easy to write a wrapper module
for e.g. mod_python or write a stand-alone web server derived from
module BaseHTTPServer.py later if you really need persistence.

Hmm, http://web2ldap.de does it like this. Hmm, it might not be a
good example for very clean code...

Ciao, Michael.



More information about the Python-list mailing list