Commit 85830ff2 authored by Jérome Perrin's avatar Jérome Perrin

When uninstalling an action, catch the error and continue installing when the action is not found.


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@5618 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 0153f990
...@@ -1725,19 +1725,23 @@ class ActionTemplateItem(ObjectTemplateItem): ...@@ -1725,19 +1725,23 @@ class ActionTemplateItem(ObjectTemplateItem):
if object_path is not None: if object_path is not None:
keys = [object_path] keys = [object_path]
else: else:
keys = self._archive.keys() keys = self._archive.keys()
for id in keys: for id in keys:
if '|' in id: if '|' in id:
relative_url, value = id.split(' | ') relative_url, value = id.split(' | ')
key = 'id' key = 'id'
else: else:
relative_url, key, value = self._splitPath(id) relative_url, key, value = self._splitPath(id)
obj = p.unrestrictedTraverse(relative_url) obj = p.unrestrictedTraverse(relative_url, None)
action_list = obj.listActions() if obj is not None:
for index in range(len(action_list)): action_list = obj.listActions()
if getattr(action_list[index], key) == value: for index in range(len(action_list)):
obj.deleteActions(selections=(index,)) if getattr(action_list[index], key) == value:
break obj.deleteActions(selections=(index,))
break
else :
LOG('BusinessTemplate', 100,
'unable to uninstall action at %s, ignoring' % relative_url )
BaseTemplateItem.uninstall(self, context, **kw) BaseTemplateItem.uninstall(self, context, **kw)
class PortalTypeRolesTemplateItem(BaseTemplateItem): class PortalTypeRolesTemplateItem(BaseTemplateItem):
......
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