Commit 3a34d980 authored by Nicolas Delaby's avatar Nicolas Delaby

index_html do not force download of files, if content-type is supported by Browser.

Force download if user ask it explicitly.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@35847 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent fc751f58
...@@ -58,6 +58,11 @@ response = request.RESPONSE\n ...@@ -58,6 +58,11 @@ response = request.RESPONSE\n
\n \n
from zExceptions import Unauthorized\n from zExceptions import Unauthorized\n
\n \n
# Always force download of document event if format is supported\n
# by browser\n
file_name = context.getStandardFileName(None)\n
response.setHeader(\'Content-disposition\', \'attachment; filename="%s"\' % file_name)\n
\n
try:\n try:\n
return context.index_html(request, response)\n return context.index_html(request, response)\n
except Unauthorized:\n except Unauthorized:\n
...@@ -106,6 +111,8 @@ except Unauthorized:\n ...@@ -106,6 +111,8 @@ except Unauthorized:\n
<string>zExceptions</string> <string>zExceptions</string>
<string>Unauthorized</string> <string>Unauthorized</string>
<string>context</string> <string>context</string>
<string>None</string>
<string>file_name</string>
<string>msg</string> <string>msg</string>
<string>dict</string> <string>dict</string>
</tuple> </tuple>
......
1593 1595
\ No newline at end of file \ No newline at end of file
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment