Commit 3c5cffb1 authored by Romain Courteaud's avatar Romain Courteaud

Bug fix: does not crash anymore if the action text is not define on a action.


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@6052 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 59fc2aff
...@@ -1690,10 +1690,13 @@ class ActionTemplateItem(ObjectTemplateItem): ...@@ -1690,10 +1690,13 @@ class ActionTemplateItem(ObjectTemplateItem):
# remove previous action # remove previous action
obj.deleteActions(selections=(index,)) obj.deleteActions(selections=(index,))
action = self._objects[id] action = self._objects[id]
action_text = action.action
if isinstance(action_text, Expression):
action_text = action_text.text
obj.addAction( obj.addAction(
id = action.id id = action.id
, name = action.title , name = action.title
, action = action.action.text , action = action_text
, condition = action.getCondition() , condition = action.getCondition()
, permission = action.permissions , permission = action.permissions
, category = action.category , category = action.category
...@@ -1722,10 +1725,13 @@ class ActionTemplateItem(ObjectTemplateItem): ...@@ -1722,10 +1725,13 @@ class ActionTemplateItem(ObjectTemplateItem):
for ai in obj.listActions(): for ai in obj.listActions():
if getattr(ai, key) == value: if getattr(ai, key) == value:
raise TemplateConflictError, 'the portal type %s already has the action %s' % (obj.id, value) raise TemplateConflictError, 'the portal type %s already has the action %s' % (obj.id, value)
action_text = action.action
if isinstance(action_text, Expression):
action_text = action_text.text
obj.addAction( obj.addAction(
id = action.id id = action.id
, name = action.title , name = action.title
, action = action.action.text , action = action_text
, condition = action.getCondition() , condition = action.getCondition()
, permission = action.permissions , permission = action.permissions
, category = action.category , category = action.category
......
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