[CMF-checkins] CVS: CMF/CMFCore - ActionProviderBase.py:1.1.2.4 CatalogTool.py:1.21.14.2 TypesTool.py:1.26.14.2

Andrew Sawyers andrew@zope.com
Thu, 3 Jan 2002 14:46:09 -0500


Update of /cvs-repository/CMF/CMFCore
In directory cvs.zope.org:/tmp/cvs-serv21742/CMFCore

Modified Files:
      Tag: andrew_ttw_actions-branch
	ActionProviderBase.py CatalogTool.py TypesTool.py 
Log Message:

*changed ActionProviderBase to use getActionExpression method
*Added TTW action support to CatalogTool and TypesTool which had
been overlooked.


=== CMF/CMFCore/ActionProviderBase.py 1.1.2.3 => 1.1.2.4 ===
                 a1['visible'] = a.getVisibility()
                 if a._action:
-                    a1['action'] = a._action.text
+                    a1['action'] = a.getActionExpression()
                 else:
                     a1['action'] = ''
                 if a.condition:
@@ -148,8 +148,6 @@
             a.title = action['name']
             if action['action'] is not '':
                 a._action = Expression(text=action['action'])
-            #if not a._action:
-            #    a._action = Expression(text=action['action'])
             else:
                 a._action = ''
             if action['condition'] is not '':


=== CMF/CMFCore/CatalogTool.py 1.21.14.1 => 1.21.14.2 ===
 from AccessControl import ClassSecurityInfo
 from utils import mergedLocalRoles
+from ActionProviderBase import ActionProviderBase
+from ActionInformation import ActionInformation
+from Expression import Expression
 import os
 import CMFCorePermissions
 from Acquisition import aq_base
@@ -64,14 +67,16 @@
         return list(allowed.keys())
 
 
-class CatalogTool (UniqueObject, ZCatalog):
+class CatalogTool (UniqueObject, ZCatalog, ActionProviderBase):
     '''This is a ZCatalog that filters catalog queries.
     '''
     id = 'portal_catalog'
     meta_type = 'CMF Catalog'
     security = ClassSecurityInfo()
+    _actions = []
 
     manage_options = ( ZCatalog.manage_options +
+                      ActionProviderBase.manage_options +
                       ({ 'label' : 'Overview', 'action' : 'manage_overview' }
                      , 
                      ))
@@ -83,6 +88,14 @@
     #
     #   Subclass extension interface
     #
+    security.declarePrivate('listActions')
+    def listActions(self, info=None):
+        """
+        Return a list of action information instances 
+        provided via tool
+        """
+        return self._actions
+
     security.declarePublic( 'enumerateIndexes' ) # Subclass can call
     def enumerateIndexes( self ):
         #   Return a list of ( index_name, type ) pairs for the initial


=== CMF/CMFCore/TypesTool.py 1.26.14.1 => 1.26.14.2 ===
 from Acquisition import aq_base
 import Products, CMFCorePermissions
+from ActionProviderBase import ActionProviderBase
+from ActionInformation import ActionInformation
+from Expression import Expression
 
 from CMFCorePermissions import View, ManagePortal, AccessContentsInformation
 
@@ -501,16 +504,18 @@
                , ScriptableTypeInformation.meta_type
                )
 
-class TypesTool( UniqueObject, OFS.Folder.Folder ):
+class TypesTool( UniqueObject, OFS.Folder.Folder, ActionProviderBase ):
     """
         Provides a configurable registry of portal content types.
     """
     id = 'portal_types'
     meta_type = 'CMF Types Tool'
+    _actions = []
 
     security = ClassSecurityInfo()
 
     manage_options = ( OFS.Folder.Folder.manage_options +
+                      ActionProviderBase.manage_options +
                       ({ 'label' : 'Overview', 'action' : 'manage_overview' }
                      , 
                      ))
@@ -521,6 +526,14 @@
     security.declareProtected( CMFCorePermissions.ManagePortal
                              , 'manage_overview' )
     manage_overview = DTMLFile( 'explainTypesTool', _dtmldir )
+
+    security.declarePrivate('listActions')
+    def listActions(self, info=None):
+        """
+        Return a list of action information instances
+        for actions provided via tool
+        """
+        return self._actions
 
     def all_meta_types(self):
         all = TypesTool.inheritedAttribute('all_meta_types')(self)