[Zope] Objet : Re: [Zope] Re: [Projet-zf] Download a file from a form
Francois-Regis CHALAOUX
Francois-Regis.CHALAOUX@sanofi-synthelabo.com
Thu, 6 Apr 2000 10:12:00 +0200
Hi,
It seems there is a problem with this syntax :
RESPONSE['Content-Disposition'] = 'attachment; filename=%s' %
name_of_the_file);
Where did you find the RESPONSE object definition ?
>>> ngarcia@gtlhpmed.paris.sanofi.com%internet 05/04/00 19:15:06 >>>
X-Accept-Language: en
FR Chalaoux wrote:
>
> Hi,
>
> I fixed the problem :
>
> getPDB method
> =============
> <dtml-var "getfiles(REQUEST, REPONSE)">
>
> getfiles.py Extension file
> ===========================
> def getfiles(self, REQUEST['ids'], RESPONSE):
> PickleJar = Trinket('/me/foo-ids.gz','x/gzip')
> PickleJar.download(RESPONSE)
> blah, blah ...
>
> But now , when I save the file the filename is getPDB (getPDB method is took
in
> fact), not the name of my downloaded file.
Modify download like so:
def download(self, RESPONSE):
RESPONSE['Content-type']=self.type
RESPONSE['Content-Disposition'] = 'attachment; filename=%s' %
name_of_the_file);
return open(self.path).read()
You'll of course have to find a way to get the name of the file there
instead of name_of_the_file, but I'm sure that's not too difficult :)
--
Nick Garcia | ngarcia@codeit.com
CodeIt Computing | http://codeit.com