Commit 9c28e76d authored by Ayush Tiwari's avatar Ayush Tiwari

erp5_catalog: Bootstrap allowed_types for Catalog Tool

parent ad22c5fc
......@@ -1971,6 +1971,14 @@ class ERP5Generator(PortalGenerator):
load(os.path.join(root, file + '.xml'),
verify=False, set_owner=False, suppress_events=True)
@staticmethod
def bootstrap_allow_type(types_tool, portal_type):
from xml.etree.cElementTree import parse
bt_path = getBootstrapBusinessTemplateUrl('erp5_core')
setattr(types_tool[portal_type], 'allowed_content_types' ,([x.text for x in parse(
os.path.join(bt_path, 'PortalTypeAllowedContentTypeTemplateItem', 'allowed_content_types.xml')
).iterfind("portal_type[@id='%s']/*" % portal_type)]))
def setupLastTools(self, p, **kw):
"""
Set up finals tools
......
......@@ -130,7 +130,10 @@ class TypesTool(TypeProvider):
'Acquired Property',
# the following ones are required to upgrade an existing site
'Category Property',
# the following is needed to bootstrap Catalog Tool and default catalog
'Catalog Tool',
))
ERP5Generator.bootstrap_allow_type(self, 'Catalog Tool')
def listContentTypes(self, container=None):
"""List content types from all providers
......
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