[Erp5-report] r32054 nicolas - /erp5/trunk/products/ERP5/Tool/ContributionTool.py

nobody at svn.erp5.org nobody at svn.erp5.org
Thu Jan 28 11:57:00 CET 2010


Author: nicolas
Date: Thu Jan 28 11:56:59 2010
New Revision: 32054

URL: http://svn.erp5.org?rev=32054&view=rev
Log:
 * Use a clever fix and let Document.discoverMetaData doing his job;
but ContributionTool is not supposed to overlaod user argument.
This is the fix: do not override file_name provided by user.
Reviewed by Jerome

Modified:
    erp5/trunk/products/ERP5/Tool/ContributionTool.py

Modified: erp5/trunk/products/ERP5/Tool/ContributionTool.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5/Tool/ContributionTool.py?rev=32054&r1=32053&r2=32054&view=diff
==============================================================================
--- erp5/trunk/products/ERP5/Tool/ContributionTool.py [utf8] (original)
+++ erp5/trunk/products/ERP5/Tool/ContributionTool.py [utf8] Thu Jan 28 11:56:59 2010
@@ -128,7 +128,6 @@
         We always generate ID. So, we must prevent using the one
         which we were provided.
     """
-    user_filename = file_name # store original filename
     if file_name is not None:
       kw['file_name'] = file_name
     if data is not None:
@@ -144,12 +143,11 @@
     document = None
 
     # Try to find the file_name
-    file_name = None
     mime_type = None
     if not url:
       # check if file was provided
       file = kw.get('file', None)
-      if file is not None:
+      if file is not None and file_name is None:
         file_name = file.filename
       else:
         # some channels supply data and file-name separately
@@ -248,9 +246,6 @@
     if getattr(document, 'guessMimeType', None) is not None:
       # For File force to setup the mime_type
       document.guessMimeType(fname=file_name)
-    if user_filename:
-      # Restore the Original filename pass by the user
-      document.setSourceReference(user_filename)
     if url:
       document.fromURL(url)
 




More information about the Erp5-report mailing list