[Zope-CMF] Suggested Change for file_view

Martijn Pieters mj@digicool.com
Thu, 3 May 2001 20:33:15 +0200


On Thu, May 03, 2001 at 10:12:32AM +0200, Martijn Pieters wrote:
> Indeed, I am in favour of eliminating the download method altogether. It
> looks like the method was ment to replace the way you View and Download a
> Product Release on Zope.org.
> 
> With the Zope.org Product Release object, you view a file by adding the
> 'view' method to the URL, and download it by usng the URL of the object
> itself.
> 
> The CMF product adds a download method, and *replaces the index_html
> method* with the download method. All the method does is add a
> Content-Disposition header, which gives the downloading browser a big hint
> as to what filename should be used. This hint is indeed needed if the last
> part of the URL is 'download', but not if the absolute URL is used.
> 
> It looks like the original intent was to replace the index_html method
> with the View operation, so that you would View the object with the URL
> itself, and use the download method for retrieving it..
> 
> However, as you noticed, Internet Explorer balks at the
> Content-Disposition header. It opens the 'Save As' dialog *twice*. The
> first time, if you choose to save the file, it suggests the filename
> 'download'. If you instead choose to 'Open' the file, it will ask you
> *again* if you want to save it or open it. The second time the correct
> filename is used.
> 
> On www.digicool.com we ran into the same problem. Removing the download
> method altogether (or at least the line 'index_html=download' from
> File.py) solved the problem.
> 
> Unless I hear a very good reason for the download method, I am going to
> check in this change into CVS (and deprecate the download method).

I deprecated the download method, using a CVS checkout of the CMF will
give you File objects that no longer try and set the Content-Disposition
header. 

This change includes your patch for the file_view.dtml method, but also
required the removal of the 'index_html - download' line in File.py. This
line caused the Content-Disposition header to be set when you used the
absoulte URL of the object as well.

Hope this helps.

-- 
Martijn Pieters
| Software Engineer  mailto:mj@digicool.com
| Digital Creations  http://www.digicool.com/
| Creators of Zope   http://www.zope.org/
---------------------------------------------