Commit d96eae9f authored by Kazuhiko Shiozaki's avatar Kazuhiko Shiozaki

Register type provider by installing ITypeProvider tool instead of installing...

Register type provider by installing ITypeProvider tool instead of installing portal types whose parent is not yet registered as type provider. This change make it possible to put only the tool in a business template without putting its inside portal types.


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@36699 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 86bb14dc
...@@ -1343,6 +1343,19 @@ class ToolTemplateItem(PathTemplateItem): ...@@ -1343,6 +1343,19 @@ class ToolTemplateItem(PathTemplateItem):
return PathTemplateItem._backupObject(self, action, None, container_path, return PathTemplateItem._backupObject(self, action, None, container_path,
object_id, **kw) object_id, **kw)
def onNewObject(self, obj):
""" When we install a tool that is a type provider not
registered on types tool, register the type provider.
"""
portal = obj.getPortalObject()
types_tool = portal.portal_types
type_container_id = obj.getId()
if interfaces.ITypeProvider.isImplementedBy(obj) and \
type_container_id not in types_tool.type_provider_list:
types_tool.type_provider_list = tuple(types_tool.type_provider_list) + \
(type_container_id,)
return PathTemplateItem.onNewObject(self, obj)
class PreferenceTemplateItem(PathTemplateItem): class PreferenceTemplateItem(PathTemplateItem):
""" """
This class is used to store preference objects This class is used to store preference objects
...@@ -1786,18 +1799,6 @@ class PortalTypeTemplateItem(ObjectTemplateItem): ...@@ -1786,18 +1799,6 @@ class PortalTypeTemplateItem(ObjectTemplateItem):
self._objects[relative_url] = obj self._objects[relative_url] = obj
obj.wl_clearLocks() obj.wl_clearLocks()
def onNewObject(self, obj):
""" When we install a type which is contained in a type provider not
registered on types tool, register the type provider.
"""
portal = obj.getPortalObject()
types_tool = portal.portal_types
type_container_id = obj.getParentId()
if type_container_id != 'portal_types' and \
type_container_id not in types_tool.type_provider_list:
types_tool.type_provider_list = tuple(types_tool.type_provider_list) + (
type_container_id,)
# XXX : this method is kept temporarily, but can be removed once all bt5 are # XXX : this method is kept temporarily, but can be removed once all bt5 are
# re-exported with separated workflow-chain information # re-exported with separated workflow-chain information
def install(self, context, trashbin, **kw): def install(self, context, trashbin, **kw):
......
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