[CMF-checkins] CVS: Products/CMFCore - ActionsTool.py:1.52
Yvo Schubbe
y.2004_ at wcm-solutions.de
Mon Aug 30 04:49:41 EDT 2004
Update of /cvs-repository/Products/CMFCore
In directory cvs.zope.org:/tmp/cvs-serv18125/CMFCore
Modified Files:
ActionsTool.py
Log Message:
- removed deprecated support for oldstyle Action Providers
=== Products/CMFCore/ActionsTool.py 1.51 => 1.52 ===
--- Products/CMFCore/ActionsTool.py:1.51 Thu Aug 12 11:07:39 2004
+++ Products/CMFCore/ActionsTool.py Mon Aug 30 04:49:41 2004
@@ -156,18 +156,11 @@
provider = getattr(self, provider_name)
if IActionProvider.isImplementedBy(provider):
actions.extend( provider.listActionInfos(object=object) )
- else:
- # for Action Providers written for CMF versions before 1.5
- actions.extend( self._listActionInfos(provider, object) )
# Include actions from object.
if object is not None:
- base = aq_base(object)
- if IActionProvider.isImplementedBy(base):
+ if IActionProvider.isImplementedBy(object):
actions.extend( object.listActionInfos(object=object) )
- elif hasattr(base, 'listActions'):
- # for objects written for CMF versions before 1.5
- actions.extend( self._listActionInfos(object, object) )
# Reorganize the actions by category.
filtered_actions={'user':[],
@@ -191,71 +184,5 @@
# listFilteredActions() is an alias.
security.declarePublic('listFilteredActions')
listFilteredActions = listFilteredActionsFor
-
- #
- # Helper method for backwards compatibility
- #
- def _listActionInfos(self, provider, object):
- """ for Action Providers written for CMF versions before 1.5
- """
- warn('ActionProvider interface not up to date. In CMF 1.6 '
- 'portal_actions will ignore listActions() of \'%s\'.'
- % provider.getId(),
- DeprecationWarning)
- info = getOAI(self, object)
- actions = provider.listActions(info)
-
- action_infos = []
- if actions and not isinstance(actions[0], dict):
- ec = getExprContext(self, object)
- for ai in actions:
- if not ai.getVisibility():
- continue
- permissions = ai.getPermissions()
- if permissions:
- category = ai.getCategory()
- if (object is not None and
- (category.startswith('object') or
- category.startswith('workflow'))):
- context = object
- elif (info['folder'] is not None and
- category.startswith('folder')):
- context = info['folder']
- else:
- context = info['portal']
- for permission in permissions:
- allowed = _checkPermission(permission, context)
- if allowed:
- break
- if not allowed:
- continue
- if not ai.testCondition(ec):
- continue
- action_infos.append( ai.getAction(ec) )
- else:
- for i in actions:
- if not i.get('visible', 1):
- continue
- permissions = i.get('permissions', None)
- if permissions:
- category = i['category']
- if (object is not None and
- (category.startswith('object') or
- category.startswith('workflow'))):
- context = object
- elif (info['folder'] is not None and
- category.startswith('folder')):
- context = info['folder']
- else:
- context = info['portal']
-
- for permission in permissions:
- allowed = _checkPermission(permission, context)
- if allowed:
- break
- if not allowed:
- continue
- action_infos.append(i)
- return action_infos
InitializeClass(ActionsTool)
More information about the CMF-checkins
mailing list