yuppie wrote:
Please make yourself familiar with these changes:
http://mail.zope.org/pipermail/zope-cmf/2003-November/019801.html
_listActionInfos() is just a fallback and never called for action
providers that implement 'interfaces.portal_actions.ActionProvider'.
All tools subclassing CMF tools or ActionProviderBase implement this
interface.
ActionProviderBase depends on getExprContext, not on getOAI. AFAIK
'OAI' means 'old ActionInformation' and is deprecated since CMF 1.3.
But DCWorkflow still depends on it, so there are no deprecation warnings.
Thank you very much for your explanation. I'm trying to get into the
changes in CMF 1.5 in the last days.
I guess you have to modify getExprContext *and* getOAI for Plone.
You are right. Of couse you are *g*
I would like to apply my patch that allows us to overwrite both
functions w/o monkey patching CMF.
Christian
------------------------------------------------------------------------
? patch.txt
Index: CMFCore/ActionProviderBase.py
===================================================================
RCS file: /cvs-repository/Products/CMFCore/ActionProviderBase.py,v
retrieving revision 1.30.2.2
diff -u -r1.30.2.2 ActionProviderBase.py
--- CMFCore/ActionProviderBase.py 16 Mar 2005 11:33:52 -0000 1.30.2.2
+++ CMFCore/ActionProviderBase.py 18 Jun 2005 12:29:19 -0000
@@ -81,7 +81,7 @@
# List ActionInfo objects.
# (method is without docstring to disable publishing)
#
- ec = getExprContext(self, object)
+ ec = self._getExprContext(self, object)
actions = self.listActions(object=object)
actions = [ ActionInfo(action, ec) for action in actions ]
@@ -109,6 +109,9 @@
if max + 1 and len(action_infos) >= max:
break
return action_infos
+
+ def _getExprContext(self, context, object):
+ return getExprContext(context, object)
security.declarePublic('getActionInfo')
def getActionInfo(self, action_chain, object=None, check_visibility=0,
Index: CMFCore/ActionsTool.py
===================================================================
RCS file: /cvs-repository/Products/CMFCore/ActionsTool.py,v
retrieving revision 1.51.2.1
diff -u -r1.51.2.1 ActionsTool.py
--- CMFCore/ActionsTool.py 11 Apr 2005 10:43:11 -0000 1.51.2.1
+++ CMFCore/ActionsTool.py 18 Jun 2005 12:29:19 -0000
@@ -197,12 +197,12 @@
'portal_actions will ignore listActions() of \'%s\'.'
% provider.getId(),
DeprecationWarning)
- info = getOAI(self, object)
+ info = self._getOAI(self, object)
actions = provider.listActions(info)
action_infos = []
if actions and not isinstance(actions[0], dict):
- ec = getExprContext(self, object)
+ ec = self._getExprContext(self, object)
for ai in actions:
if not ai.getVisibility():
continue
@@ -252,5 +252,11 @@
continue
action_infos.append(i)
return action_infos
+
+ def _getOAI(self, context, object):
+ return getOAI(context, object)
+
+ def _getExprContext(self, context, object):
+ return getExprContext(context, object)
InitializeClass(ActionsTool)
Index: CMFCore/DiscussionTool.py
===================================================================
RCS file: /cvs-repository/Products/CMFCore/DiscussionTool.py,v
retrieving revision 1.17.2.2
diff -u -r1.17.2.2 DiscussionTool.py
--- CMFCore/DiscussionTool.py 16 Mar 2005 11:33:52 -0000 1.17.2.2
+++ CMFCore/DiscussionTool.py 18 Jun 2005 12:29:20 -0000
@@ -160,7 +160,7 @@
def listActions(self, info=None, object=None):
# Return actions for reply and show replies
if object is not None or info is None:
- info = getOAI(self, object)
+ info = self._getOAI(self, object)
content = info.object
if content is None or not self.isDiscussionAllowedFor(content):
return ()
@@ -180,5 +180,8 @@
)
return actions
+
+ def _getOAI(self, context, object):
+ return getOAI(context, object)
InitializeClass(DiscussionTool)
Index: CMFCore/WorkflowTool.py
===================================================================
RCS file: /cvs-repository/Products/CMFCore/WorkflowTool.py,v
retrieving revision 1.46.2.5
diff -u -r1.46.2.5 WorkflowTool.py
--- CMFCore/WorkflowTool.py 26 Apr 2005 16:03:36 -0000 1.46.2.5
+++ CMFCore/WorkflowTool.py 18 Jun 2005 12:29:21 -0000
@@ -228,7 +228,7 @@
o Global actions are supplied by all workflows.
"""
if object is not None or info is None:
- info = getOAI(self, object)
+ info = self._getOAI(self, object)
chain = self.getChainFor(info.object)
did = {}
actions = []
@@ -253,6 +253,9 @@
if a is not None:
actions.extend(a)
return actions
+
+ def _getOAI(self, context, object):
+ return getOAI(context, object)
security.declarePublic('getActionsFor')
def getActionsFor(self, ob):