Commit ba6c616e authored by Romain Courteaud's avatar Romain Courteaud

Raise a more error message to help debugging.

This should not impact the performance, as this method is cached.


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@15268 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 525c8194
...@@ -39,21 +39,22 @@ def CMFBTreeFolder_allowedContentTypes(self): ...@@ -39,21 +39,22 @@ def CMFBTreeFolder_allowedContentTypes(self):
if myType is not None: if myType is not None:
allowed_types_to_check = [] allowed_types_to_check = []
if myType.filter_content_types: if myType.filter_content_types:
result = [portal_types.getTypeInfo(x) for x in for portal_type in myType.allowed_content_types:
myType.allowed_content_types] contentType = portal_types.getTypeInfo(portal_type)
if contentType is None:
raise AttributeError, "Portal type '%s' does not exist " \
"and should not be allowed in '%s'" % \
(portal_type, self.getPortalType())
result.append(contentType)
else: else:
if myType is not None: for contentType in portal_types.listTypeInfo(self):
for contentType in portal_types.listTypeInfo(self): if myType.allowType(contentType.getId()):
if myType.allowType( contentType.getId() ): result.append(contentType)
result.append( contentType )
else: else:
result = portal_types.listTypeInfo() result = portal_types.listTypeInfo()
return filter( lambda typ, container=self: return filter(
typ.isConstructionAllowed( container ) lambda typ, container=self: typ.isConstructionAllowed(container),
, result ) result)
CMFBTreeFolder.allowedContentTypes = CMFBTreeFolder_allowedContentTypes CMFBTreeFolder.allowedContentTypes = CMFBTreeFolder_allowedContentTypes
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