Commit 2c471817 authored by Nicolas Delaby's avatar Nicolas Delaby

rename file variable into file_object + small optimisations


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@41122 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 6b125957
......@@ -100,10 +100,10 @@ class File(Document, CMFFile):
"""
This is used to edit files
"""
if kw.has_key('file'):
file = kw.get('file')
if 'file' in kw:
file_object = kw.pop('file')
precondition = kw.get('precondition')
filename = getattr(file, 'filename', None)
filename = getattr(file_object, 'filename', None)
# if file field is empty(no file is uploaded),
# filename is empty string.
if not filename:
......@@ -113,9 +113,8 @@ class File(Document, CMFFile):
filename = kw.get('filename')
if filename:
self._setFilename(filename)
if self._isNotEmpty(file):
self._setFile(file, precondition=precondition)
del kw['file']
if self._isNotEmpty(file_object):
self._setFile(file_object, precondition=precondition)
Base._edit(self, **kw)
security.declareProtected( Permissions.ModifyPortalContent, 'edit' )
......
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