Commit b3a56ca3 authored by Ivan Tyagov's avatar Ivan Tyagov

Minor fixes

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@14128 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 38f073f4
...@@ -151,7 +151,7 @@ class ContributionTool(BaseTool): ...@@ -151,7 +151,7 @@ class ContributionTool(BaseTool):
# if we have only one, then this is it # if we have only one, then this is it
# LOG('findTypeName single portal_type_list', 0, portal_type_list[0]) # LOG('findTypeName single portal_type_list', 0, portal_type_list[0])
return portal_type_list[0] return portal_type_list[0]
# If it is still None, we need to read the document # If it is still None, we need to read the document
# to check which of the candidates is suitable # to check which of the candidates is suitable
# Let us give a chance to getPropertyDictFromContent to # Let us give a chance to getPropertyDictFromContent to
...@@ -328,19 +328,15 @@ class ContributionTool(BaseTool): ...@@ -328,19 +328,15 @@ class ContributionTool(BaseTool):
method = self._getTypeBasedMethod('getPropertyDictFromFileName', method = self._getTypeBasedMethod('getPropertyDictFromFileName',
fallback_script_id = 'ContributionTool_getPropertyDictFromFileName') fallback_script_id = 'ContributionTool_getPropertyDictFromFileName')
property_dict = method(file_name, property_dict) property_dict = method(file_name, property_dict)
if property_dict.has_key('portal_type') and property_dict['portal_type']: if property_dict.get('portal_type', None) is not None:
# we have to return portal_type as a tuple # we have to return portal_type as a tuple
# because we should allow for having multiple candidate types # because we should allow for having multiple candidate types
property_dict['portal_type'] = (property_dict['portal_type'],) property_dict['portal_type'] = (property_dict['portal_type'],)
else: else:
# we have to find candidates by file extenstion # we have to find candidates by file extenstion
try: if file_name.rfind('.')!= -1:
index = file_name.rfind('.') ext = file_name.split('.')[-1]
if index != -1: property_dict['portal_type'] = self.ContributionTool_getCandidateTypeListByExtension(ext)
ext = file_name[index+1:]
property_dict['portal_type'] = self.ContributionTool_getCandidateTypeListByExtension(ext)
except ValueError: # no dot in file name
pass
return property_dict return property_dict
# WebDAV virtual folder support # WebDAV virtual folder support
...@@ -659,4 +655,4 @@ class ContributionTool(BaseTool): ...@@ -659,4 +655,4 @@ class ContributionTool(BaseTool):
# Pass exception to Zope (ex. conflict errors) # Pass exception to Zope (ex. conflict errors)
raise raise
InitializeClass(ContributionTool) InitializeClass(ContributionTool)
\ No newline at end of file
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