Commit 2f89a180 authored by Kazuhiko Shiozaki's avatar Kazuhiko Shiozaki

return action information's getActionInfo() value in...

return action information's getActionInfo() value in ERP5Type.getFilteredActionListFor(). with this way, createExpressionContext() is called only once per ActionsTool.listFilteredActionsFor() call.


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@29618 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 6f7c7ba3
No related merge requests found
......@@ -519,8 +519,8 @@ class ERP5TypeInformation(XMLObject,
def getFilteredActionListFor(self, ob=None):
"""Return all actions applicable to the object"""
ec = createExpressionContext(ob)
return (action for action in self.getActionInformationList()
if action.test(ec))
return (action.getActionInfo(ec) for action \
in self.getActionInformationList() if action.test(ec))
security.declareProtected(Permissions.AccessContentsInformation,
'getActionInformationList')
......
......@@ -30,12 +30,8 @@ def listFilteredActionsFor(self, object=None):
if IActionProvider.isImplementedBy(provider):
actions.extend( provider.listActionInfos(object=object) )
elif hasattr(provider, 'getFilteredActionListFor'):
from Products.ERP5Type.Utils import createExpressionContext
ec = createExpressionContext(object)
actions += sorted(
(action.getActionInfo(ec)
for action in provider.getFilteredActionListFor(object)),
key=lambda x: x['priority'])
actions += sorted(provider.getFilteredActionListFor(object),
key=lambda x:x['priority'])
else:
# for Action Providers written for CMF versions before 1.5
actions.extend( self._listActionInfos(provider, object) )
......
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