[Erp5-report] r38376 nicolas - /erp5/trunk/products/ERP5/Tool/ContributionTool.py
nobody at svn.erp5.org
nobody at svn.erp5.org
Tue Sep 14 22:27:23 CEST 2010
Author: nicolas
Date: Tue Sep 14 22:27:23 2010
New Revision: 38376
URL: http://svn.erp5.org?rev=38376&view=rev
Log:
Use os.path.splitext to extract file extension
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=38376&r1=38375&r2=38376&view=diff
==============================================================================
--- erp5/trunk/products/ERP5/Tool/ContributionTool.py [utf8] (original)
+++ erp5/trunk/products/ERP5/Tool/ContributionTool.py [utf8] Tue Sep 14 22:27:23 2010
@@ -330,9 +330,11 @@ class ContributionTool(BaseTool):
property_dict['portal_type'] = (property_dict['portal_type'],)
else:
# we have to find candidates by file extenstion
- if file_name.rfind('.')!= -1:
- ext = file_name.split('.')[-1]
- property_dict['portal_type'] = self.ContributionTool_getCandidateTypeListByExtension(ext)
+ basename, extension = os.path.splitext(file_name)
+ if extension:
+ extension = extension.lstrip('.') # remove first dot
+ property_dict['portal_type'] =\
+ self.ContributionTool_getCandidateTypeListByExtension(extension)
return property_dict
# WebDAV virtual folder support
More information about the Erp5-report
mailing list