[Checkins] SVN: Products.CMFCore/trunk/Products/CMFCore/ - Actions: Added deprecation warnings to the ZMI actions tab and
Jens Vagelpohl
jens at dataflake.org
Sat Oct 4 11:16:57 EDT 2008
Log message for revision 91749:
- Actions: Added deprecation warnings to the ZMI actions tab and
most listActions methods where old-style actions are found
asking developers to move to new-style actions instead. These
warnings allow us to remove old-style actions code by version 2.4.
Changed:
U Products.CMFCore/trunk/Products/CMFCore/ActionProviderBase.py
U Products.CMFCore/trunk/Products/CMFCore/ActionsTool.py
U Products.CMFCore/trunk/Products/CMFCore/CHANGES.txt
U Products.CMFCore/trunk/Products/CMFCore/TypesTool.py
U Products.CMFCore/trunk/Products/CMFCore/dtml/editToolsActions.dtml
U Products.CMFCore/trunk/Products/CMFCore/tests/test_ActionProviderBase.py
-=-
Modified: Products.CMFCore/trunk/Products/CMFCore/ActionProviderBase.py
===================================================================
--- Products.CMFCore/trunk/Products/CMFCore/ActionProviderBase.py 2008-10-04 14:44:27 UTC (rev 91748)
+++ Products.CMFCore/trunk/Products/CMFCore/ActionProviderBase.py 2008-10-04 15:16:57 UTC (rev 91749)
@@ -15,6 +15,8 @@
$Id$
"""
+from warnings import warn
+
from AccessControl import ClassSecurityInfo
from Globals import DTMLFile
from Globals import InitializeClass
@@ -57,8 +59,14 @@
def listActions(self, info=None, object=None):
""" List all the actions defined by a provider.
"""
- return self._actions or ()
+ oldstyle_actions = self._actions or ()
+ if oldstyle_actions:
+ warn('Old-style actions are deprecated and will be removed in CMF '
+ '2.4. Use Action and Action Category objects instead.',
+ DeprecationWarning, stacklevel=2)
+ return oldstyle_actions
+
security.declarePrivate('getActionObject')
def getActionObject(self, action):
"""Return the actions object or None if action doesn't exist.
Modified: Products.CMFCore/trunk/Products/CMFCore/ActionsTool.py
===================================================================
--- Products.CMFCore/trunk/Products/CMFCore/ActionsTool.py 2008-10-04 14:44:27 UTC (rev 91748)
+++ Products.CMFCore/trunk/Products/CMFCore/ActionsTool.py 2008-10-04 15:16:57 UTC (rev 91749)
@@ -15,6 +15,8 @@
$Id$
"""
+from warnings import warn
+
from AccessControl import ClassSecurityInfo
from Globals import DTMLFile
from Globals import InitializeClass
@@ -112,7 +114,12 @@
def listActions(self, info=None, object=None):
""" List all the actions defined by a provider.
"""
- actions = list(self._actions)
+ oldstyle_actions = self._actions or ()
+ if oldstyle_actions:
+ warn('Old-style actions are deprecated and will be removed in CMF '
+ '2.4. Use Action and Action Category objects instead.',
+ DeprecationWarning, stacklevel=2)
+ actions = list(oldstyle_actions)
for category in self.objectValues():
actions.extend( category.listActions() )
return tuple(actions)
Modified: Products.CMFCore/trunk/Products/CMFCore/CHANGES.txt
===================================================================
--- Products.CMFCore/trunk/Products/CMFCore/CHANGES.txt 2008-10-04 14:44:27 UTC (rev 91748)
+++ Products.CMFCore/trunk/Products/CMFCore/CHANGES.txt 2008-10-04 15:16:57 UTC (rev 91749)
@@ -4,6 +4,11 @@
2.2.0 (unreleased)
------------------
+- Actions: Added deprecation warnings to the ZMI actions tab and
+ most listActions methods where old-style actions are found
+ asking developers to move to new-style actions instead. These
+ warnings allow us to remove old-style actions code by version 2.4.
+
- Discussion tool: Removed the listActions method that would return
a hardcoded Reply action. This action has been handled by the
Actions tool itself for a while now, and the Discussions tool was
Modified: Products.CMFCore/trunk/Products/CMFCore/TypesTool.py
===================================================================
--- Products.CMFCore/trunk/Products/CMFCore/TypesTool.py 2008-10-04 14:44:27 UTC (rev 91748)
+++ Products.CMFCore/trunk/Products/CMFCore/TypesTool.py 2008-10-04 15:16:57 UTC (rev 91749)
@@ -781,7 +781,12 @@
def listActions(self, info=None, object=None):
""" List all the actions defined by a provider.
"""
- actions = list( self._actions )
+ oldstyle_actions = self._actions or ()
+ if oldstyle_actions:
+ warn('Old-style actions are deprecated and will be removed in CMF '
+ '2.4. Use Action and Action Category objects instead.',
+ DeprecationWarning, stacklevel=2)
+ actions = list(oldstyle_actions)
if object is None and info is not None:
object = info.object
Modified: Products.CMFCore/trunk/Products/CMFCore/dtml/editToolsActions.dtml
===================================================================
--- Products.CMFCore/trunk/Products/CMFCore/dtml/editToolsActions.dtml 2008-10-04 14:44:27 UTC (rev 91748)
+++ Products.CMFCore/trunk/Products/CMFCore/dtml/editToolsActions.dtml 2008-10-04 15:16:57 UTC (rev 91749)
@@ -13,6 +13,16 @@
</dtml-let>
<dtml-var manage_tabs>
+<p>
+ <span style="{Color:red}" class="form-label">DEPRECATION WARNING</span><br/>
+ <span class="form-help">
+ Storing actions here is deprecated. Please move to using Action and
+ Action Category objects. See the CMF ActionsTool implementation for
+ details. Starting with CMF 2.4, the "Actions" tab will no longer be
+ shown for tools provided by the CMF.
+ </span>
+</p>
+
<form action="&dtml-absolute_url;" method="POST">
<dtml-if actions>
Modified: Products.CMFCore/trunk/Products/CMFCore/tests/test_ActionProviderBase.py
===================================================================
--- Products.CMFCore/trunk/Products/CMFCore/tests/test_ActionProviderBase.py 2008-10-04 14:44:27 UTC (rev 91748)
+++ Products.CMFCore/trunk/Products/CMFCore/tests/test_ActionProviderBase.py 2008-10-04 15:16:57 UTC (rev 91749)
@@ -24,6 +24,7 @@
from Products.CMFCore.tests.base.dummy import DummySite
from Products.CMFCore.tests.base.dummy import DummyTool
from Products.CMFCore.tests.base.testcase import SecurityRequestTest
+from Products.CMFCore.tests.base.testcase import WarningInterceptor
#
# We have to import these here to make the "ugly sharing" test case go.
@@ -60,9 +61,10 @@
)
-class ActionProviderBaseTests(SecurityRequestTest):
+class ActionProviderBaseTests(SecurityRequestTest, WarningInterceptor):
def setUp(self):
+ self._trap_warning_output()
SecurityRequestTest.setUp(self)
self.site = DummySite('site').__of__(self.root)
utool = self.site._setObject( 'portal_url', DummyTool() )
@@ -71,6 +73,7 @@
def tearDown(self):
cleanUp()
SecurityRequestTest.tearDown(self)
+ self._free_warning_output()
def _makeProvider( self, dummy=0 ):
More information about the Checkins
mailing list