Commit a38c0782 authored by Ayush Tiwari's avatar Ayush Tiwari

erp5_catalog: Boostrap allowed_types for Catalog Tool

parent 4d529450
...@@ -21,6 +21,7 @@ from OFS.Application import Application, AppInitializer ...@@ -21,6 +21,7 @@ from OFS.Application import Application, AppInitializer
from Products.ERP5Type import Globals from Products.ERP5Type import Globals
from Products.ERP5Type.Globals import package_home from Products.ERP5Type.Globals import package_home
from lxml.etree import parse
from Products.SiteErrorLog.SiteErrorLog import manage_addErrorLog from Products.SiteErrorLog.SiteErrorLog import manage_addErrorLog
from ZPublisher import BeforeTraverse from ZPublisher import BeforeTraverse
from ZPublisher.BaseRequest import RequestContainer from ZPublisher.BaseRequest import RequestContainer
...@@ -1941,6 +1942,14 @@ class ERP5Generator(PortalGenerator): ...@@ -1941,6 +1942,14 @@ class ERP5Generator(PortalGenerator):
load(os.path.join(root, file + '.xml'), load(os.path.join(root, file + '.xml'),
verify=False, set_owner=False, suppress_events=True) 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): def setupLastTools(self, p, **kw):
""" """
Set up finals tools Set up finals tools
......
...@@ -130,7 +130,10 @@ class TypesTool(TypeProvider): ...@@ -130,7 +130,10 @@ class TypesTool(TypeProvider):
'Acquired Property', 'Acquired Property',
# the following ones are required to upgrade an existing site # the following ones are required to upgrade an existing site
'Category Property', '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): def listContentTypes(self, container=None):
"""List content types from all providers """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