Commit 3946c317 authored by Nicolas Delaby's avatar Nicolas Delaby

Set filename on document before upload file

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@28975 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 68b4b1aa
......@@ -110,14 +110,14 @@ class File(Document, CMFFile, ConversionCacheMixin):
if kw.has_key('file'):
file = kw.get('file')
precondition = kw.get('precondition')
if self._isNotEmpty(file):
self._setFile(file, precondition=precondition)
if set_filename__:
filename = getattr(file, 'filename', None)
# if file field is empty(no file is uploaded),
# filename is empty string.
if filename not in (None, ''):
kw['source_reference'] = filename
self._setSourceReference(filename)
if self._isNotEmpty(file):
self._setFile(file, precondition=precondition)
del kw['file']
Base._edit(self, **kw)
......
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