CGI/HTML forms in a standalone application.

Michael Ströder michael.stroeder at inka.de
Fri Feb 18 08:35:31 EST 2000


Moshe Zadka wrote:
> 
> On Fri, 18 Feb 2000, Michael [iso-8859-1] Ströder wrote:
> 
> > > You can derive a class from SimpleHTTPRequestHandler, copy some code from
> > > CGIHTTPRequestHandler and come up with a class
> > > CGILikePythonFunctionHTTPRequestHandler
> >
> > I did this and it works as expected except that the browser does not
> > stop loading. Do I have to close a socket or associated file?
> 
> Yes: you have to close the associated file object, which you get as an
> attribute of the class in the .handle() method.

Are you sure? I tried to close self.wfile and self.rfile but an
exception was thrown because some lower class (SocketServer? Can't
remember) tried to flush the output file.

Well, now I found a solution to my problem (see also thread "derived
from CGIHTTPServer.py"). I messed around with directly using sys.stdin.
After cleaning up my code and using self.rfile and self.wfile directly
it works for HTTP-GET. But HTTP-POST still hangs...

Ciao, Michael.



More information about the Python-list mailing list