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): ...@@ -100,10 +100,10 @@ class File(Document, CMFFile):
""" """
This is used to edit files This is used to edit files
""" """
if kw.has_key('file'): if 'file' in kw:
file = kw.get('file') file_object = kw.pop('file')
precondition = kw.get('precondition') precondition = kw.get('precondition')
filename = getattr(file, 'filename', None) filename = getattr(file_object, 'filename', None)
# if file field is empty(no file is uploaded), # if file field is empty(no file is uploaded),
# filename is empty string. # filename is empty string.
if not filename: if not filename:
...@@ -113,9 +113,8 @@ class File(Document, CMFFile): ...@@ -113,9 +113,8 @@ class File(Document, CMFFile):
filename = kw.get('filename') filename = kw.get('filename')
if filename: if filename:
self._setFilename(filename) self._setFilename(filename)
if self._isNotEmpty(file): if self._isNotEmpty(file_object):
self._setFile(file, precondition=precondition) self._setFile(file_object, precondition=precondition)
del kw['file']
Base._edit(self, **kw) Base._edit(self, **kw)
security.declareProtected( Permissions.ModifyPortalContent, 'edit' ) 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