[Erp5-report] r14201 - /erp5/trunk/products/ERP5/Document/Document.py

nobody at svn.erp5.org nobody at svn.erp5.org
Tue Apr 24 22:01:10 CEST 2007


Author: ivan
Date: Tue Apr 24 22:01:04 2007
New Revision: 14201

URL: http://svn.erp5.org?rev=14201&view=rev
Log:
Code cleanup. Do not unconditionally set file_name.

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

Modified: erp5/trunk/products/ERP5/Document/Document.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5/Document/Document.py?rev=14201&r1=14200&r2=14201&view=diff
==============================================================================
--- erp5/trunk/products/ERP5/Document/Document.py (original)
+++ erp5/trunk/products/ERP5/Document/Document.py Tue Apr 24 22:01:04 2007
@@ -966,15 +966,14 @@
       user_login - this is a login string of a person; can be None if the user is
                    currently logged in, then we'll get him from session
     """   
-    # Get the order
+    if file_name is not None:
+      # filename is often undefined....
+      self._setSourceReference(file_name)
     # Preference is made of a sequence of 'user_login', 'content', 'file_name', 'input'
-    self._setSourceReference(file_name) # XXX Who added this ???
-                                       # filename is often undefined....
     method = self._getTypeBasedMethod('getPreferredDocumentMetadataDiscoveryOrderList', 
         fallback_script_id = 'Document_getPreferredDocumentMetadataDiscoveryOrderList')
     order_list = list(method())
     order_list.reverse()
-
     # Start with everything until content - build a dictionary according to the order
     kw = {}
     for order_id in order_list:
@@ -993,20 +992,18 @@
       else:
         result = method()
       if result is not None:
-        # LOG('discoverMetadata %s' % order_id, 0, repr(result))
         kw.update(result)
 
     # Prepare the content edit parameters - portal_type should not be changed
-    try:
-      del(kw['portal_type'])
-    except KeyError:
-      pass
-    self._edit(**kw) # Try not to invoke an automatic transition here
-    self.finishIngestion() # Finish ingestion by calling method
+    kw.pop('portal_type', None)
+    # Try not to invoke an automatic transition here
+    self._edit(**kw)
+    # Finish ingestion by calling method
+    self.finishIngestion() 
     self.reindexObject()
-    return self.mergeRevision() # Revision merge is tightly coupled
-                                # to metadata discovery - refer to the documentation
-                                # of mergeRevision method
+    # Revision merge is tightly coupled
+    # to metadata discovery - refer to the documentation of mergeRevision method
+    return self.mergeRevision() 
 
   security.declareProtected(Permissions.ModifyPortalContent, 'finishIngestion')
   def finishIngestion(self):




More information about the Erp5-report mailing list