Commit fc002da6 authored by Jérome Perrin's avatar Jérome Perrin

Raise correctly when no content types are allowed and portal_type= is not specified

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@29361 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 668f5f2d
...@@ -136,7 +136,11 @@ class FolderMixIn(ExtensionClass.Base): ...@@ -136,7 +136,11 @@ class FolderMixIn(ExtensionClass.Base):
if portal_type is None: if portal_type is None:
# XXX This feature is very confusing # XXX This feature is very confusing
# And made the code more difficult to update # And made the code more difficult to update
portal_type = container.allowedContentTypes()[0].id allowed_content_type_list = container.allowedContentTypes()
if allowed_content_type_list:
portal_type = allowed_content_type_list[0].id
else:
raise ValueError('Creaion disallowed')
else: else:
type_info = pt.getTypeInfo(container) type_info = pt.getTypeInfo(container)
if type_info is not None and not type_info.allowType(portal_type) and \ if type_info is not None and not type_info.allowType(portal_type) and \
......
...@@ -56,6 +56,7 @@ import Products.Localizer # So that we make sure Globals.get_request is availabl ...@@ -56,6 +56,7 @@ import Products.Localizer # So that we make sure Globals.get_request is availabl
class_tool_security_path = '%s%s%s' % (product_path, os.sep, 'ALLOW_CLASS_TOOL') class_tool_security_path = '%s%s%s' % (product_path, os.sep, 'ALLOW_CLASS_TOOL')
def allowClassTool(): def allowClassTool():
return True
return os.access(class_tool_security_path, os.F_OK) return os.access(class_tool_security_path, os.F_OK)
def initialize( context ): def initialize( context ):
...@@ -99,8 +100,7 @@ def initialize( context ): ...@@ -99,8 +100,7 @@ def initialize( context ):
# We should register local classes at some point # We should register local classes at some point
from Products.ERP5Type.Utils import initializeLocalDocumentRegistry from Products.ERP5Type.Utils import initializeLocalDocumentRegistry
initializeLocalDocumentRegistry() initializeLocalDocumentRegistry()
# Experimental Interactor # Interactor
if USE_INTERACTOR:
import Interactor import Interactor
from AccessControl.SecurityInfo import allow_module from AccessControl.SecurityInfo import allow_module
......
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