[mod_python] how to write response in same page

Néstor Chacón Manzano nchacon at caton.es
Thu Nov 9 10:13:22 EST 2006


Hello, i have a little form

<form action="python/cgi-bin/getFile" method="post" enctype="multipart/form-data">
   	<input type="file" name="file" />
   	<input type="submit" name="submit" value="Subir" />
</form> 

in /var/www/python/ i have the script that get the information

from mod_python import apache
def getFile(req, file=None):
     req.content_type = "text/html" 
     if file is None:
          req.write("Datos Nulos")
      if type(file) is str:
          req.write("Datos Erróneos")
      fileData = file.file.read()    
      if fileData:
	f=open("/tmp/archivo","w")
	f.write(fileData)
	f.close()
	req.write(str(dir(req)))
      else:
	req.write("Archivo vacío")

When the process executes the "req.write" appears the menssage in a new ( reloaded ) window.
How i can for write the menssage in the same window ( with not reload ) ?

Thanks




More information about the Mod_python mailing list