[Erp5-report] r41122 nicolas - /erp5/trunk/products/ERP5/Document/File.py

nobody at svn.erp5.org nobody at svn.erp5.org
Sat Dec 4 15:50:47 CET 2010


Author: nicolas
Date: Sat Dec  4 15:50:47 2010
New Revision: 41122

URL: http://svn.erp5.org?rev=41122&view=rev
Log:
rename file variable into file_object + small optimisations

Modified:
    erp5/trunk/products/ERP5/Document/File.py

Modified: erp5/trunk/products/ERP5/Document/File.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5/Document/File.py?rev=41122&r1=41121&r2=41122&view=diff
==============================================================================
--- erp5/trunk/products/ERP5/Document/File.py [utf8] (original)
+++ erp5/trunk/products/ERP5/Document/File.py [utf8] Sat Dec  4 15:50:47 2010
@@ -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' )



More information about the Erp5-report mailing list