[CMF-checkins] SVN: CMF/trunk/C - removed deprecated WorkflowInformation and getActionsFor

Yvo Schubbe y.2005- at wcm-solutions.de
Fri Nov 18 04:20:00 EST 2005


Log message for revision 40206:
  - removed deprecated WorkflowInformation and getActionsFor

Changed:
  U   CMF/trunk/CHANGES.txt
  U   CMF/trunk/CMFCore/WorkflowTool.py
  U   CMF/trunk/CMFCore/interfaces/_tools.py
  U   CMF/trunk/CMFCore/tests/test_WorkflowTool.py

-=-
Modified: CMF/trunk/CHANGES.txt
===================================================================
--- CMF/trunk/CHANGES.txt	2005-11-18 09:18:48 UTC (rev 40205)
+++ CMF/trunk/CHANGES.txt	2005-11-18 09:19:59 UTC (rev 40206)
@@ -140,6 +140,8 @@
 
   Others
 
+    - Workflow: Removed deprecated WorkflowInformation and getActionsFor.
+
     - CMFCore and GenericSetup: Moved mechanisms for content export / import
       to GenericSetup/content.py, and made more generic.
 

Modified: CMF/trunk/CMFCore/WorkflowTool.py
===================================================================
--- CMF/trunk/CMFCore/WorkflowTool.py	2005-11-18 09:18:48 UTC (rev 40205)
+++ CMF/trunk/CMFCore/WorkflowTool.py	2005-11-18 09:19:59 UTC (rev 40206)
@@ -16,7 +16,6 @@
 """
 
 import sys
-from warnings import warn
 
 from AccessControl import ClassSecurityInfo
 from Acquisition import aq_base, aq_inner, aq_parent
@@ -40,27 +39,7 @@
 
 _marker = []  # Create a new marker object.
 
-class WorkflowInformation:
 
-    """ Shim implementation of ActionInformation, to enable
-        querying actions without mediation of the 'portal_actions' tool.
-    """
-    def __init__(self, object):
-        warn('WorkflowInformation() is deprecated and will be removed in '
-             'CMF 2.0.',
-             DeprecationWarning)
-        self.object = self.content = object
-        self.content_url = object.absolute_url()
-        self.portal_url = self.folder_url = ''
-
-    def __getitem__(self, name):
-        if name[:1] == '_':
-            raise KeyError, name
-        if hasattr(self, name):
-            return getattr(self, name)
-        raise KeyError, name
-
-
 class WorkflowTool(UniqueObject, Folder, ActionProviderBase):
 
     """ Mediator tool, mapping workflow objects
@@ -262,17 +241,6 @@
                         actions.extend(a)
         return actions
 
-    security.declarePublic('getActionsFor')
-    def getActionsFor(self, ob):
-
-        """ Return a list of action dictionaries for 'ob', just as though
-            queried via 'ActionsTool.listFilteredActionsFor'.
-        """
-        warn('getActionsFor() is deprecated and will be removed in CMF 2.0. '
-             'Please use listActionInfos() instead.',
-             DeprecationWarning)
-        return self.listActions( WorkflowInformation( ob ) )
-
     security.declarePublic('doActionFor')
     def doActionFor(self, ob, action, wf_id=None, *args, **kw):
 

Modified: CMF/trunk/CMFCore/interfaces/_tools.py
===================================================================
--- CMF/trunk/CMFCore/interfaces/_tools.py	2005-11-18 09:18:48 UTC (rev 40205)
+++ CMF/trunk/CMFCore/interfaces/_tools.py	2005-11-18 09:19:59 UTC (rev 40206)
@@ -1513,17 +1513,6 @@
         o Permission:  Private (Python only)
         """
 
-    def getActionsFor(ob):
-        """ Return a list of action dictionaries for 'ob'
-
-        o Generate the list as though queried via
-          'ActionsTool.listFilteredActionsFor'.
-
-        o This method is deprecated and will be removed in CMF 2.0.
-
-        o Permission:  Public
-        """
-
     def doActionFor(ob, action, wf_id=None, *args, **kw):
         """ Perform the given workflow action on 'ob'.
 

Modified: CMF/trunk/CMFCore/tests/test_WorkflowTool.py
===================================================================
--- CMF/trunk/CMFCore/tests/test_WorkflowTool.py	2005-11-18 09:18:48 UTC (rev 40205)
+++ CMF/trunk/CMFCore/tests/test_WorkflowTool.py	2005-11-18 09:19:59 UTC (rev 40206)
@@ -15,10 +15,8 @@
 $Id$
 """
 
-from unittest import TestCase, TestSuite, makeSuite, main
+import unittest
 import Testing
-import Zope2
-Zope2.startup()
 
 from OFS.SimpleItem import SimpleItem
 
@@ -133,7 +131,7 @@
         return None
 
 
-class WorkflowToolTests(TestCase, WarningInterceptor):
+class WorkflowToolTests(unittest.TestCase, WarningInterceptor):
 
     def setUp( self ):
         from Products.CMFCore.WorkflowTool import addWorkflowFactory
@@ -291,18 +289,6 @@
         self.failUnless( 'dummy' in vars.keys() )
         self.failUnless( 'a: dummy' in vars.values() )
 
-    def test_getActionsFor( self ):
-
-        import warnings
-
-        # Collector #360: Test AtttributeError in deprecated API :(
-        tool = self._makeWithTypesAndChain()
-        dummy = DummyContent( 'dummy' )
-
-        self._trap_warning_output()
-        actions = tool.getActionsFor( dummy )
-        self.assertEqual( len( actions ), 0 )
-
     def test_getInfoFor( self ):
 
         tool = self._makeWithTypesAndChain()
@@ -383,9 +369,9 @@
 
 
 def test_suite():
-    return TestSuite((
-        makeSuite(WorkflowToolTests),
+    return unittest.TestSuite((
+        unittest.makeSuite(WorkflowToolTests),
         ))
 
 if __name__ == '__main__':
-    main(defaultTest='test_suite')
+    unittest.main(defaultTest='test_suite')



More information about the CMF-checkins mailing list