[Erp5-report] r29618 - in /erp5/trunk/products/ERP5Type: ERP5Type.py patches/ActionsTool.py
nobody at svn.erp5.org
nobody at svn.erp5.org
Tue Oct 13 23:33:53 CEST 2009
Author: kazuhiko
Date: Tue Oct 13 23:33:52 2009
New Revision: 29618
URL: http://svn.erp5.org?rev=29618&view=rev
Log:
return action information's getActionInfo() value in ERP5Type.getFilteredActionListFor(). with this way, createExpressionContext() is called only once per ActionsTool.listFilteredActionsFor() call.
Modified:
erp5/trunk/products/ERP5Type/ERP5Type.py
erp5/trunk/products/ERP5Type/patches/ActionsTool.py
Modified: erp5/trunk/products/ERP5Type/ERP5Type.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5Type/ERP5Type.py?rev=29618&r1=29617&r2=29618&view=diff
==============================================================================
--- erp5/trunk/products/ERP5Type/ERP5Type.py [utf8] (original)
+++ erp5/trunk/products/ERP5Type/ERP5Type.py [utf8] Tue Oct 13 23:33:52 2009
@@ -519,8 +519,8 @@
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')
Modified: erp5/trunk/products/ERP5Type/patches/ActionsTool.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5Type/patches/ActionsTool.py?rev=29618&r1=29617&r2=29618&view=diff
==============================================================================
--- erp5/trunk/products/ERP5Type/patches/ActionsTool.py [utf8] (original)
+++ erp5/trunk/products/ERP5Type/patches/ActionsTool.py [utf8] Tue Oct 13 23:33:52 2009
@@ -30,12 +30,8 @@
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) )
More information about the Erp5-report
mailing list