Fix 'icon' and 'name' for ActionInfo objects on CMF 2.2 (approved by jm)

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@30538 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent dba31739
...@@ -167,20 +167,19 @@ try: ...@@ -167,20 +167,19 @@ try:
if not isinstance(action, dict): if not isinstance(action, dict):
# ivan # ivan
if self.data.get('icon') is not None: if self.data.get('icon') is not None:
self.data['icon'] = self._getIcon def getIcon(ec=ec):
# On CMF 2.2 the ec parameter is not passed.
icon_expression_obj = action._getIconObject()
if icon_expression_obj not in ('', None):
return icon_expression_obj(ec)
self.data['icon'] = getIcon
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. # put back 'name' if it's not there. CMF 2.x removes it.
self.data['name'] = self.data['title'] self.data['name'] = self['title']
def _getIcon(self):
# ivan
icon_expression_obj = self._action._getIconObject()
if icon_expression_obj not in ('', None):
return icon_expression_obj(self._ec)
ActionInfo.__init__ = __init__ ActionInfo.__init__ = __init__
ActionInfo._getIcon = _getIcon
except ImportError: except ImportError:
pass pass
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