Commit 14f54456 authored by Aurel's avatar Aurel

BusinessTemplate: when installing tool, register it on the site manager

parent 3fb49aab
......@@ -39,6 +39,7 @@ from AccessControl.SecurityManagement import getSecurityManager, \
newSecurityManager, setSecurityManager
from AccessControl.User import nobody
from Products.CMFCore.utils import getToolByName
from Products.CMFCore import utils
from Products.PythonScripts.PythonScript import PythonScript
from Products.ZSQLMethods.SQL import SQL
from Products.ERP5Type.Accessor.Constant import PropertyGetter as ConstantGetter
......@@ -1869,6 +1870,7 @@ class ToolTemplateItem(PathTemplateItem):
def install(self, context, trashbin, **kw):
""" When we install a tool that is a type provider not
registered on types tool, register it into the type provider.
We also need to register the tool on the site manager
"""
PathTemplateItem.install(self, context, trashbin, **kw)
portal = context.getPortalObject()
......@@ -1879,6 +1881,10 @@ class ToolTemplateItem(PathTemplateItem):
type_container_id not in types_tool.type_provider_list):
types_tool.type_provider_list = tuple(types_tool.type_provider_list) + \
(type_container_id,)
tool_interface = utils._tool_interface_registry.get(type_container_id)
if tool_interface is not None:
sm = self.getPortalObject()._components
sm.registerUtility(aq_base(portal.get(type_container_id)), tool_interface)
def uninstall(self, context, **kw):
""" When we uninstall a tool, unregister it from the type provider. """
......
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