Commit 6b125957 authored by Nicolas Delaby's avatar Nicolas Delaby

File._edit assume that file property is a FileObject with filename attribute.

But through Contribution Tool, file is just a StringIO object without filename attribute.
As filename is provided in kw, we fallback on kw.get('filename') to get the value
of filename instead of reading it from file.


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@41121 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 2711d40b
......@@ -106,6 +106,11 @@ class File(Document, CMFFile):
filename = getattr(file, 'filename', None)
# if file field is empty(no file is uploaded),
# filename is empty string.
if not filename:
# settings the filename before calling
# _setFile is required to setup the content_type
# property
filename = kw.get('filename')
if filename:
self._setFilename(filename)
if self._isNotEmpty(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