[Zope] python Script and download file

Dieter Maurer dieter at handshake.de
Fri Dec 5 15:15:39 EST 2003


Hervé Richard wrote at 2003-12-5 15:53 +0100:
>It almost works but ... here is my script (named "sendMeAr") :
> ...
>return fileObj.index_html(context.REQUEST, context.REQUEST.RESPONSE)
>-------------------------
>When i try, if i hit Unix button i get the popup to download 
>arUnixV2.tar.gz, and so on,
>BUT
>the name of each of file is :
>for mac button : sendMeAr29ac392e in place of arMacV2.sea.hqx
>for unix button : sendMeAr39d43f39 in place of arWinV2.zip
>for win button :  sendMeAr3a318f43 in place of arUnixV2.tar.gz

You seem to have a funny browser :-)

The "Content-Disposition" header should allow you to control
the filename. Search for details.

Some browsers, especially some version of IE, think they know
better and ignore the header. In this case, it is necessary
to provide the wanted filename as last URL component.
This is possible with a PythonScript and it "traversal_subpath".
Read about this feature in the Zope Book (2.6 edition, online).

-- 
Dieter



More information about the Zope mailing list