[Zope] python Script and download file

Dieter Maurer dieter at handshake.de
Thu Dec 4 16:27:44 EST 2003


Hervé Richard wrote at 2003-12-4 15:30 +0100:
>It's probably a newbie question :
>I want to write a python script form action which return a file to 
>download:
>In a folder i have 2 files ("A.tgz" and "B.tgz") and a Page Template 
>Object (download.html). This page is a form with multiple choice in 
>order to seclect a file to download (if the user select "A" button, he 
>get the A.tgz file, if select "B" he get A.tgz ...) I want to write a 
>python script method to render the file but i don't know how create the 
>command to pass the file to downlown.

I do not understand what you mean with "create the command to pass the file".

If the file is a Zope "File" object, then its "index_html"
renders its content. Your PythonScript could return in this
case:

	return fileObject.index_html(container.REQUEST,
                                     container.REQUEST.RESPONSE
				     )

-- 
Dieter



More information about the Zope mailing list