[Zope-CMF] Suggested Change for file_view

Martijn Pieters mj@digicool.com
Thu, 3 May 2001 10:12:32 +0200


On Wed, May 02, 2001 at 04:05:23PM -0400, Rolander, Dan wrote:
> Perhaps it works differently with Netscape on *nix, but for Internet
> Explorer on Windows clicking on a file download link in CMF causes IE to
> open a File Save dialog with the file name as 'download'. This is a pain to
> change, especially if the user doesn't know what the file name should be. If
> you change the following line in file_view it will instead make the default
> file name the object id, which if given the file name will be the correct
> default download name.
>  
> Change
>  
>     <a href="download">Download &dtml-title;</a>
>  
> To
>  
>     <a href="&dtml-absolute_url;">Download &dtml-title;</a>
>  
> I'm still a newbie at this, so perhaps it was set to "download" by design,
> but it works better for me as the absolute url.

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).

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