Commit b222c538 authored by Kazuhiko Shiozaki's avatar Kazuhiko Shiozaki

we cache cloned Expressions because original ones are persistent objects.


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@29733 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 04b1cfb0
...@@ -179,15 +179,26 @@ class ActionInformation(XMLObject): ...@@ -179,15 +179,26 @@ class ActionInformation(XMLObject):
def getRawActionInformation(self): def getRawActionInformation(self):
"""Return RawActionInformation instance that is not persistent and """Return RawActionInformation instance that is not persistent and
is cacheable.""" is cacheable."""
# we cache cloned Expressions because original ones are persistent
# objects.
icon = self.getIcon()
if icon is not None:
icon = Expression(icon.text)
action = self.getAction()
if action is not None:
action = Expression(action.text)
condition = self.getCondition()
if condition is not None:
condition = Expression(condition.text)
return RawActionInformation( return RawActionInformation(
{'id':self.getReference(), {'id':self.getReference(),
'name':self.getTitle(), 'name':self.getTitle(),
'description':self.getDescription(), 'description':self.getDescription(),
'category':self.getActionType(), 'category':self.getActionType(),
'priority':self.getFloatIndex(), 'priority':self.getFloatIndex(),
'icon':self.getIcon(), 'icon':icon,
'action':self.getAction(), 'action':action,
'condition':self.getCondition(), 'condition':condition,
'action_permission':self.getActionPermissionList(), 'action_permission':self.getActionPermissionList(),
} }
) )
......
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