Reinstate ActionInfo key removed by CMF 2.2 but used by templates in our...

Reinstate ActionInfo key removed by CMF 2.2 but used by templates in our BusinessTemplates. Also make sure not to obliterate newly provided keys on ActionInformation (not to be confused with ActionInfo). (approved by jm)

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@29879 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 81a42d6f
...@@ -135,20 +135,16 @@ if 1: ...@@ -135,20 +135,16 @@ if 1:
, icon=self.getIconExpression() , icon=self.getIconExpression()
) )
ActionInformation_getMapping = ActionInformation.getMapping
def getMapping(self): def getMapping(self):
""" Get a mapping of this object's data. """ Get a mapping of this object's data.
""" """
return { 'id': self.id, mapping = ActionInformation_getMapping(self)
'title': self.title or self.id, # missing on CMF 1.5, provided as icon_expression on CMF 2
'description': self.description, mapping['icon'] = icon=self.getIconExpression()
'category': self.category or 'object', # missing on both CMF 1.5 and 2
'condition': getattr(self, 'condition', None) mapping['priority'] = self.getPriority()
and self.condition.text or '', return mapping
'permissions': self.permissions,
'visible': bool(self.visible),
'action': self.getActionExpression(),
'icon': self.getIconExpression(),
'priority': self.getPriority() }
ActionInformation.__init__ = __init__ ActionInformation.__init__ = __init__
ActionInformation.getAction = getAction ActionInformation.getAction = getAction
...@@ -175,6 +171,8 @@ try: ...@@ -175,6 +171,8 @@ try:
self._lazy_keys.append('icon') self._lazy_keys.append('icon')
else: else:
self.data['icon'] = '' self.data['icon'] = ''
# put back 'name' if it's not there. CMF 2.x removes it.
self.data['name'] = self.data['title']
def _getIcon(self): def _getIcon(self):
# ivan # ivan
......
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