Commit 8677ec17 authored by Nicolas Delaby's avatar Nicolas Delaby

Use only portal_contribution_registry, then follow standart API

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@41649 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 0f0d3bee
...@@ -213,18 +213,10 @@ class Folder: ...@@ -213,18 +213,10 @@ class Folder:
Returns -- Bare and empty object of the appropriate type (or None, if Returns -- Bare and empty object of the appropriate type (or None, if
we don't know what to do) we don't know what to do)
""" """
findPortalTypeName = None portal = self.getPortalObject()
registry = getToolByName(self, 'portal_contribution_registry', None) registry = portal.portal_contribution_registry
if registry is not None: portal_type = registry.findPortalTypeName(filename=name,
findPortalTypeName = registry.findPortalTypeName content_type=typ)
else:
# Keep backward compatibility
registry = getToolByName(self, 'content_type_registry', None)
if registry is None:
return None
findPortalTypeName = registry.findTypeName
portal_type = findPortalTypeName(name, typ, body)
if portal_type is None: if portal_type is None:
return None return None
...@@ -234,7 +226,7 @@ class Folder: ...@@ -234,7 +226,7 @@ class Folder:
if myType is not None and not myType.allowType( portal_type ) and \ if myType is not None and not myType.allowType( portal_type ) and \
'portal_contributions' not in self.getPhysicalPath(): 'portal_contributions' not in self.getPhysicalPath():
raise ValueError('Disallowed subobject type: %s' % portal_type) raise ValueError('Disallowed subobject type: %s' % portal_type)
container = self.getPortalObject().getDefaultModule(portal_type) container = portal.getDefaultModule(portal_type)
pt.constructContent(type_name=portal_type, pt.constructContent(type_name=portal_type,
container=container, container=container,
id=name) id=name)
......
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