[CMF-checkins] CVS: CMF/CMFCore - ActionProviderBase.py:1.1.2.3 ActionsTool.py:1.19.10.3 SkinsTool.py:1.11.14.2

Andrew Sawyers andrew@zope.com
Thu, 3 Jan 2002 10:07:54 -0500


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

Modified Files:
      Tag: andrew_ttw_actions-branch
	ActionProviderBase.py ActionsTool.py SkinsTool.py 
Log Message:

*Various logic and bug fixes to ActionsTool and
ActionProviderBase
*Added TTW Action support to SkinsTool and URLTool



=== CMF/CMFCore/ActionProviderBase.py 1.1.2.2 => 1.1.2.3 ===
             a.id = action['id']
             a.title = action['name']
-            if not a._action:
+            if action['action'] is not '':
                 a._action = Expression(text=action['action'])
+            #if not a._action:
+            #    a._action = Expression(text=action['action'])
             else:
-                a._action.text = action['action']
+                a._action = ''
             if action['condition'] is not '':
                 a.condition = Expression(text=action['condition'])
             else:


=== CMF/CMFCore/ActionsTool.py 1.19.10.2 => 1.19.10.3 ===
         """
         #import pdb; pdb.set_trace()
-        providers = self.listActionProviders()
+        providers = list(self.listActionProviders())
         new_providers = []
         if add_provider:
             providers.append(apname)
@@ -186,10 +186,11 @@
             provider = getattr(self, provider_name)
             a = provider.listActions(info)
             #import pdb; pdb.set_trace()
-            if a and type(a[0]) is not {}:
+            if a and type(a[0]) is not type({}):
                 ai_objs.extend(list(a))
-            elif len(a) > 0:
-                actions.append(a)
+            else:
+                for i in a: 
+                    actions.append(i)
 
         if ai_objs:
             for ai in ai_objs:


=== CMF/CMFCore/SkinsTool.py 1.11.14.1 => 1.11.14.2 ===
 from AccessControl import ClassSecurityInfo
 from CMFCorePermissions import ManagePortal, AccessContentsInformation
+from ActionProviderBase import ActionProviderBase
+from ActionInformation import ActionInformation
+from Expression import Expression
 
 from OFS.Image import Image
 from OFS.DTMLMethod import DTMLMethod
@@ -53,13 +56,14 @@
                   'action':'manage_propertiesForm'}]
     return tuple(rval)
 
-class SkinsTool(UniqueObject, SkinsContainer, PortalFolder):
+class SkinsTool(UniqueObject, SkinsContainer, PortalFolder, ActionProviderBase):
     '''
     This tool is used to supply skins to a portal.
     '''
 
     id = 'portal_skins'
     meta_type = 'CMF Skins Tool'
+    _actions = []
     cookie_persistence = 0
 
     security = ClassSecurityInfo()
@@ -67,7 +71,8 @@
     manage_options = ( modifiedOptions() +
                       ({ 'label' : 'Overview', 'action' : 'manage_overview' }
                      , 
-                     ))
+                     ) + ActionProviderBase.manage_options
+                     )
 
     def __init__(self):
         self.selections = PersistentMapping()
@@ -90,6 +95,14 @@
     request_varname = 'portal_skin'
     allow_any = 0
     selections = None
+
+    security.declarePrivate('listActions')
+    def listActions(self, info=None):
+        """
+        Return a list of actions information instances
+        provided by the tool.
+        """
+        return self._actions
 
     security.declareProtected(ManagePortal, 'manage_propertiesForm')
     manage_propertiesForm = DTMLFile('dtml/skinProps', globals())