[Zope] Serving external files

Phil Harris phil.harris@zope.co.uk
Tue, 28 Mar 2000 09:45:18 +0100


Allen,

Try looking at the LocalFS product available on the Zope.org site.

It makes folders on the physical drive look like part of the ZODB.

HTH

Phil
phil.harris@zope.co.uk

----- Original Message ----- 
From: "Allen Wallis" <allen@rrsg.ee.uct.ac.za>
To: <zope@zope.org>
Sent: Tuesday, March 28, 2000 9:09 AM
Subject: [Zope] Serving external files


> Hi,
> I have some questions about serving external files:
> 
> I want to be able to serve a file that is external to Zope's Object
> database. This file would probably be a binary file. So far, I have an
> external method that reads the data from the file, and sets the header
> of the RESPONSE object passed to it. The external method looks something
> like:
>     def readFile(self, REQUEST, RESPONSE):
>         ...
>         data = f.read()   # where f is the binary file, and has been
> opened
>        RESPONSE.setHeader("Content-Type", "application/data")
>         return data
> 
> The zope id of the external method is "getFile".
> 
> I have a dtml method that calls this external method, using
> <dtml-var "getFile(REQUEST, RESPONSE)">
> The id of this dtml method is "download".
> Say I have a dtm document with something like
> <a href="download">SomeFile.dat</a>
> 
> This works, and the file is downloaded correctly. I want to know firstly
> whether there is a better way of achieving this.
> Secondly, when the user clicks on the SomeFile.dat hyperlink, and the
> browser's "save as" dialog pops up, the browser uses the id of the dtml
> method "download" as the filename in the dialog. Obviously I would
> rather this dialog shows the name of the file that will be downloaded.
> How can I change this? I can't rename the dtml method suitable for each
> different filname that might be downloaded, so where else can I alter
> this behaviour?
> 
> Thanks
> Allen
> 
> 
> _______________________________________________
> Zope maillist  -  Zope@zope.org
> http://lists.zope.org/mailman/listinfo/zope
> **   No cross posts or HTML encoding!  **
> (Related lists - 
>  http://lists.zope.org/mailman/listinfo/zope-announce
>  http://lists.zope.org/mailman/listinfo/zope-dev )