Commit 6d9c057c authored by Bartek Górny's avatar Bartek Górny

cleaned and reformatted some code

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@12841 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 339d53d4
...@@ -876,25 +876,25 @@ class ERP5Site(FolderMixIn, CMFSite): ...@@ -876,25 +876,25 @@ class ERP5Site(FolderMixIn, CMFSite):
if hasattr(portal_object, module_name): if hasattr(portal_object, module_name):
return module_name return module_name
# then look for module where the type is allowed # then look for module where the type is allowed
module_name=None module_name = None
modlist=[m for m in self.objectIds() if m.endswith('module')] modlist = [m for m in self.objectIds() if m.endswith('module')]
for mod in modlist: for mod in modlist:
module=self.restrictedTraverse(mod,None) module = self.restrictedTraverse(mod, None)
if module is None: # we can't access this one if module is None: # we can't access this one
continue continue
if portal_type in self.portal_types[module.getPortalType()].allowed_content_types: if portal_type in self.portal_types[module.getPortalType()].allowed_content_types:
module_name=mod module_name = mod
break break
if module_name is not None: if module_name is not None:
return module_name return module_name
if default is not MARKER: if default is not MARKER:
return default return default
# now we fail
LOG('ERP5Site, getDefaultModuleId', 0, LOG('ERP5Site, getDefaultModuleId', 0,
'Unable to find default module for portal_type: %s' % \ 'Unable to find default module for portal_type: %s' % \
portal_type) portal_type)
raise ValueError, 'Unable to find module for portal_type: %s' % \ raise ValueError, 'Unable to find module for portal_type: %s' % \
portal_type portal_type
return module_name
security.declareProtected(Permissions.AccessContentsInformation, security.declareProtected(Permissions.AccessContentsInformation,
'getDefaultModule') 'getDefaultModule')
......
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