Commit 1d6cf43c authored by Aurel's avatar Aurel

- recreate right path when comparing object thus avoiding aving

remove/install of allowed/hidden content types, property sheet et base
category on portal type
- do the same with workflow chain, and check chain by chain instead of
all at once


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@16162 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 3e7bcbfe
...@@ -1502,6 +1502,39 @@ class PortalTypeWorkflowChainTemplateItem(BaseTemplateItem): ...@@ -1502,6 +1502,39 @@ class PortalTypeWorkflowChainTemplateItem(BaseTemplateItem):
del chain_dict[id] del chain_dict[id]
context.portal_workflow.manage_changeWorkflows('', props=chain_dict) context.portal_workflow.manage_changeWorkflows('', props=chain_dict)
def preinstall(self, context, installed_bt, **kw):
modified_object_list = {}
if context.getTemplateFormatVersion() == 1:
new_keys = self._objects.keys()
new_dict = PersistentMapping()
# Fix key from installed bt if necessary
for key in installed_bt._objects.keys():
if not "portal_type_workflow_chain/" in key:
new_key = 'portal_type_workflow_chain/%s' %key
new_dict[new_key] = installed_bt._objects[key]
else:
new_dict[key] = installed_bt._objects[key]
if len(new_dict):
installed_bt._objects = new_dict
for path in new_keys:
if installed_bt._objects.has_key(path):
# compare object to see it there is changes
new_object = self._objects[path]
old_object = installed_bt._objects[path]
# compare same type of object
if isinstance(old_object, list) or isinstance(old_object, tuple):
old_object = ', '.join(old_object)
if new_object != old_object:
modified_object_list.update({path : ['Modified', self.__class__.__name__[:-12]]})
else: # new object
modified_object_list.update({path : ['New', self.__class__.__name__[:-12]]})
# get removed object
old_keys = installed_bt._objects.keys()
for path in old_keys:
if path not in new_keys:
modified_object_list.update({path : ['Removed', self.__class__.__name__[:-12]]})
return modified_object_list
def _importFile(self, file_name, file): def _importFile(self, file_name, file):
# import workflow chain for portal_type # import workflow chain for portal_type
dict = {} dict = {}
...@@ -1580,12 +1613,15 @@ class PortalTypeAllowedContentTypeTemplateItem(BaseTemplateItem): ...@@ -1580,12 +1613,15 @@ class PortalTypeAllowedContentTypeTemplateItem(BaseTemplateItem):
if context.getTemplateFormatVersion() == 1: if context.getTemplateFormatVersion() == 1:
portal = context.getPortalObject() portal = context.getPortalObject()
new_keys = self._objects.keys() new_keys = self._objects.keys()
if installed_bt.id == 'installed_bt_for_diff': new_dict = PersistentMapping()
#must rename keys in dict if reinstall # fix key if necessary in installed bt for diff
new_dict = PersistentMapping() for key in installed_bt._objects.keys():
for key in installed_bt._objects.keys(): if self.class_property not in key:
new_key = self.class_property+'/'+key new_key = self.class_property+'/'+key
new_dict[new_key] = installed_bt._objects[key] new_dict[new_key] = installed_bt._objects[key]
else:
new_dict[key] = installed_bt._objects[key]
if len(new_dict):
installed_bt._objects = new_dict installed_bt._objects = new_dict
for path in new_keys: for path in new_keys:
if installed_bt._objects.has_key(path): if installed_bt._objects.has_key(path):
......
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