[CMF-checkins] CVS: CMF/CMFCore - ActionInformation.py:1.9 ActionProviderBase.py:1.10

Tres Seaver tseaver@zope.com
Wed, 3 Jul 2002 16:27:45 -0400


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

Modified Files:
	ActionInformation.py ActionProviderBase.py 
Log Message:



  - ActionInformation:
  
    o Make old tools forward compatible in the face of an attribute
      name change ('_action' -> 'action').

  - ActionProviderBase:

    o Let ActionInformation handle the case that the action /
      condition is missing.


=== CMF/CMFCore/ActionInformation.py 1.8 => 1.9 ===
         """ Return the text of the TALES expression for our URL.
         """
-        return self.action and self.action.text or ''
+        action = getattr( self, 'action', None )
+
+        if action is None:  # Forward compatibility, used to be '_action'
+            action = getattr( self, '_action', None )
+            if action is not None:
+                self.action = self._action
+                del self._action
+
+        return action and action.text or ''
 
     security.declarePublic( 'getCondition' )
     def getCondition(self):
 
         """ Return the text of the TALES expression for our condition.
         """
-        return self.condition and self.condition.text or ''
+        return getattr( self, 'condition', None ) and self.condition.text or ''
 
     security.declarePublic( 'getPermission' )
     def getPermissions( self ):


=== CMF/CMFCore/ActionProviderBase.py 1.9 => 1.10 ===
                 a1['category'] = a.getCategory() or 'object'
                 a1['visible'] = a.getVisibility()
-                if a._action:
-                    a1['action'] = a.getActionExpression()
-                else:
-                    a1['action'] = ''
-                if a.condition:
-                    a1['condition'] = a.getCondition()
-                else:
-                    a1['condition'] = ''
+                a1['action'] = a.getActionExpression()
+                a1['condition'] = a.getCondition()
                 actions.append(a1)
 
         # possible_permissions is in AccessControl.Role.RoleManager.