Commit 63f01287 authored by Kazuhiko Shiozaki's avatar Kazuhiko Shiozaki

* set filename into source_reference.

* try to use source_reference first as filename.


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@16941 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent a2606bc7
......@@ -109,7 +109,7 @@ class File(Document, CMFFile, ConversionCacheMixin):
### Special edit method
security.declarePrivate( '_edit' )
def _edit(self, **kw):
def _edit(self, set_filename__=1, **kw):
"""\
This is used to edit files
"""
......@@ -118,6 +118,10 @@ class File(Document, CMFFile, ConversionCacheMixin):
precondition = kw.get('precondition')
if self._isNotEmpty(file):
self._setFile(file, precondition=precondition)
if set_filename__:
filename = getattr(file, 'filename', None)
if filename is not None:
kw['source_reference'] = filename
del kw['file']
Base._edit(self, **kw)
......
......@@ -311,7 +311,7 @@ class ContributionTool(BaseTool):
try:
# Then edit the document contents (so that upload can happen)
document._edit(**kw)
document._edit(set_filename__=0, **kw)
if url:
document.fromURL(url)
finally:
......
......@@ -76,7 +76,7 @@ if hasattr(context,\'getContentType\'):\n
else:\n
response.RESPONSE.setHeader(\'Content-type\', context.getFormat())\n
\n
file_name = context.getTitle() or context.getSourceReference() or context.getId()\n
file_name = context.getSourceReference() or context.getTitle() or context.getId()\n
response.setHeader(\'Content-disposition\', \'attachment;; filename="%s"\' % file_name)\n
return context.index_html(request, response)\n
</string> </value>
......
522
\ No newline at end of file
523
\ 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