[CMF-checkins] SVN: CMF/trunk/C - removed backwards bridge for
interfaces that don't exist in CMF 1.5
Yvo Schubbe
y.2005- at wcm-solutions.de
Sat Sep 24 17:57:55 EDT 2005
Log message for revision 38604:
- removed backwards bridge for interfaces that don't exist in CMF 1.5
- using IFAwareObjectManager with z3 interfaces
- checking for z2 *and* z3 interfaces where only isImplementedBy was used
CMF itself should no longer depend on any z2 interfaces, but WriteLockInterface is still required for Zope
Changed:
U CMF/trunk/CHANGES.txt
U CMF/trunk/CMFCore/ActionInformation.py
U CMF/trunk/CMFCore/ActionsTool.py
U CMF/trunk/CMFCore/TypesTool.py
U CMF/trunk/CMFCore/__init__.py
U CMF/trunk/CMFCore/interfaces/__init__.py
U CMF/trunk/CMFCore/tests/test_ActionInformation.py
U CMF/trunk/CMFDefault/DiscussionTool.py
U CMF/trunk/CMFSetup/actions.py
-=-
Modified: CMF/trunk/CHANGES.txt
===================================================================
--- CMF/trunk/CHANGES.txt 2005-09-24 20:51:36 UTC (rev 38603)
+++ CMF/trunk/CHANGES.txt 2005-09-24 21:57:54 UTC (rev 38604)
@@ -55,8 +55,8 @@
snapshot and re-import Actions using the portal_setup tool.
- TypesTool: TypeInformation classes are now pluggable.
- Any class that implements the TypeInformation interface and is
- a registered meta type can now be used in the TypesTool.
+ Any class registered for ITypeInformation can now be used in the
+ TypesTool.
Bug Fixes
Modified: CMF/trunk/CMFCore/ActionInformation.py
===================================================================
--- CMF/trunk/CMFCore/ActionInformation.py 2005-09-24 20:51:36 UTC (rev 38603)
+++ CMF/trunk/CMFCore/ActionInformation.py 2005-09-24 21:57:54 UTC (rev 38604)
@@ -31,8 +31,6 @@
from interfaces import IAction
from interfaces import IActionCategory
from interfaces import IActionInfo
-from interfaces.portal_actions import Action as z2IAction
-from interfaces.portal_actions import ActionCategory as z2IActionCategory
from interfaces.portal_actions import ActionInfo as z2IActionInfo
from permissions import View
from utils import _checkPermission
@@ -44,15 +42,16 @@
_unchanged = [] # marker
class ActionCategory(IFAwareObjectManager, OrderedFolder):
+
""" Group of Action objects.
"""
implements(IActionCategory)
- __implements__ = (z2IActionCategory, OrderedFolder.__implements__)
+ __implements__ = OrderedFolder.__implements__
meta_type = 'CMF Action Category'
- _product_interfaces = (z2IActionCategory, z2IAction)
+ _product_interfaces = (IActionCategory, IAction)
security = ClassSecurityInfo()
@@ -63,9 +62,9 @@
actions = []
for obj in self.objectValues():
- if z2IActionCategory.isImplementedBy(obj):
+ if IActionCategory.providedBy(obj):
actions.extend( obj.listActions() )
- elif z2IAction.isImplementedBy(obj):
+ elif IAction.providedBy(obj):
actions.append(obj)
return tuple(actions)
@@ -86,11 +85,11 @@
class Action(SimpleItemWithProperties):
+
""" Reference to an action.
"""
implements(IAction)
- __implements__ = z2IAction
meta_type = 'CMF Action'
i18n_domain = 'cmf_default'
@@ -182,6 +181,7 @@
class ActionInfo(UserDict):
+
""" A lazy dictionary for Action infos.
"""
@@ -273,7 +273,6 @@
"""
implements(IAction)
- __implements__ = z2IAction
_isActionInformation = 1
__allow_access_to_unprotected_subobjects__ = 1
Modified: CMF/trunk/CMFCore/ActionsTool.py
===================================================================
--- CMF/trunk/CMFCore/ActionsTool.py 2005-09-24 20:51:36 UTC (rev 38603)
+++ CMF/trunk/CMFCore/ActionsTool.py 2005-09-24 21:57:54 UTC (rev 38604)
@@ -23,8 +23,9 @@
from zope.interface import implements
from ActionProviderBase import ActionProviderBase
+from interfaces import IActionCategory
+from interfaces import IActionProvider
from interfaces import IActionsTool
-from interfaces.portal_actions import ActionCategory as z2IActionCategory
from interfaces.portal_actions import ActionProvider as z2IActionProvider
from interfaces.portal_actions import portal_actions as z2IActionsTool
from permissions import ManagePortal
@@ -46,7 +47,7 @@
id = 'portal_actions'
meta_type = 'CMF Actions Tool'
- _product_interfaces = (z2IActionCategory,)
+ _product_interfaces = (IActionCategory,)
action_providers = ('portal_types', 'portal_workflow', 'portal_actions')
security = ClassSecurityInfo()
@@ -157,12 +158,14 @@
# Include actions from specific tools.
for provider_name in self.listActionProviders():
provider = getattr(self, provider_name)
- if z2IActionProvider.isImplementedBy(provider):
+ if IActionProvider.providedBy(provider) or \
+ z2IActionProvider.isImplementedBy(provider):
actions.extend( provider.listActionInfos(object=object) )
# Include actions from object.
if object is not None:
- if z2IActionProvider.isImplementedBy(object):
+ if IActionProvider.providedBy(object) or \
+ z2IActionProvider.isImplementedBy(object):
actions.extend( object.listActionInfos(object=object) )
# Reorganize the actions by category.
Modified: CMF/trunk/CMFCore/TypesTool.py
===================================================================
--- CMF/trunk/CMFCore/TypesTool.py 2005-09-24 20:51:36 UTC (rev 38603)
+++ CMF/trunk/CMFCore/TypesTool.py 2005-09-24 21:57:54 UTC (rev 38604)
@@ -657,7 +657,7 @@
id = 'portal_types'
meta_type = 'CMF Types Tool'
- _product_interfaces = (z2ITypeInformation,)
+ _product_interfaces = (ITypeInformation,)
security = ClassSecurityInfo()
Modified: CMF/trunk/CMFCore/__init__.py
===================================================================
--- CMF/trunk/CMFCore/__init__.py 2005-09-24 20:51:36 UTC (rev 38603)
+++ CMF/trunk/CMFCore/__init__.py 2005-09-24 21:57:54 UTC (rev 38604)
@@ -34,6 +34,9 @@
import CMFBTreeFolder
import utils
+from interfaces import IAction
+from interfaces import IActionCategory
+from interfaces import ITypeInformation
from permissions import AddPortalFolders
from permissions import ManagePortal
@@ -132,7 +135,8 @@
constructors=(ActionInformation.manage_addActionCategoryForm,
ActionInformation.manage_addActionCategory),
icon='images/cmf_action_category.gif',
- visibility=None)
+ visibility=None,
+ interfaces=(IActionCategory,))
context.registerClass(
ActionInformation.Action,
@@ -140,21 +144,24 @@
constructors=(ActionInformation.manage_addActionForm,
ActionInformation.manage_addAction),
icon='images/cmf_action.gif',
- visibility=None)
+ visibility=None,
+ interfaces=(IAction,))
context.registerClass(
TypesTool.FactoryTypeInformation,
permission=ManagePortal,
constructors=( TypesTool.manage_addFactoryTIForm, ),
icon='images/typeinfo.gif',
- visibility=None)
+ visibility=None,
+ interfaces=(ITypeInformation,))
context.registerClass(
TypesTool.ScriptableTypeInformation,
permission=ManagePortal,
constructors=( TypesTool.manage_addScriptableTIForm, ),
icon='images/typeinfo.gif',
- visibility=None)
+ visibility=None,
+ interfaces=(ITypeInformation,))
utils.registerIcon(FSDTMLMethod.FSDTMLMethod,
'images/fsdtml.gif', globals())
Modified: CMF/trunk/CMFCore/interfaces/__init__.py
===================================================================
--- CMF/trunk/CMFCore/interfaces/__init__.py 2005-09-24 20:51:36 UTC (rev 38603)
+++ CMF/trunk/CMFCore/interfaces/__init__.py 2005-09-24 21:57:54 UTC (rev 38604)
@@ -64,8 +64,6 @@
'ICallableOpaqueItemEvents')
createZope3Bridge(IActionsTool, portal_actions, 'portal_actions')
createZope3Bridge(IActionProvider, portal_actions, 'ActionProvider')
-createZope3Bridge(IActionCategory, portal_actions, 'ActionCategory')
-createZope3Bridge(IAction, portal_actions, 'Action')
createZope3Bridge(IActionInfo, portal_actions, 'ActionInfo')
createZope3Bridge(ICatalogTool, portal_catalog, 'portal_catalog')
createZope3Bridge(IIndexableObjectWrapper, portal_catalog,
Modified: CMF/trunk/CMFCore/tests/test_ActionInformation.py
===================================================================
--- CMF/trunk/CMFCore/tests/test_ActionInformation.py 2005-09-24 20:51:36 UTC (rev 38603)
+++ CMF/trunk/CMFCore/tests/test_ActionInformation.py 2005-09-24 21:57:54 UTC (rev 38604)
@@ -39,14 +39,6 @@
return ActionCategory(*args, **kw)
- def test_z2interfaces(self):
- from Interface.Verify import verifyClass
- from Products.CMFCore.ActionInformation import ActionCategory
- from Products.CMFCore.interfaces.portal_actions \
- import ActionCategory as IActionCategory
-
- verifyClass(IActionCategory, ActionCategory)
-
def test_z3interfaces(self):
from zope.interface.verify import verifyClass
from Products.CMFCore.ActionInformation import ActionCategory
@@ -72,14 +64,6 @@
return Action(*args, **kw)
- def test_z2interfaces(self):
- from Interface.Verify import verifyClass
- from Products.CMFCore.ActionInformation import Action
- from Products.CMFCore.interfaces.portal_actions \
- import Action as IAction
-
- verifyClass(IAction, Action)
-
def test_z3interfaces(self):
from zope.interface.verify import verifyClass
from Products.CMFCore.ActionInformation import Action
@@ -321,14 +305,6 @@
return ActionInformation(*args, **kw)
- def test_z2interfaces(self):
- from Interface.Verify import verifyClass
- from Products.CMFCore.ActionInformation import ActionInformation
- from Products.CMFCore.interfaces.portal_actions \
- import Action as IAction
-
- verifyClass(IAction, ActionInformation)
-
def test_z3interfaces(self):
from zope.interface.verify import verifyClass
from Products.CMFCore.ActionInformation import ActionInformation
Modified: CMF/trunk/CMFDefault/DiscussionTool.py
===================================================================
--- CMF/trunk/CMFDefault/DiscussionTool.py 2005-09-24 20:51:36 UTC (rev 38603)
+++ CMF/trunk/CMFDefault/DiscussionTool.py 2005-09-24 21:57:54 UTC (rev 38604)
@@ -23,6 +23,7 @@
from zope.interface import implements
from Products.CMFCore.ActionProviderBase import ActionProviderBase
+from Products.CMFCore.interfaces import IDiscussionResponse
from Products.CMFCore.interfaces import IDiscussionTool
from Products.CMFCore.interfaces.Discussions \
import DiscussionResponse as z2IDiscussionResponse
@@ -89,7 +90,8 @@
if not self.isDiscussionAllowedFor( content ):
raise DiscussionNotAllowed
- if not z2IDiscussionResponse.isImplementedBy(content) and \
+ if not IDiscussionResponse.providedBy(content) and \
+ not z2IDiscussionResponse.isImplementedBy(content) and \
getattr( aq_base(content), 'talkback', None ) is None:
# Discussion Items use the DiscussionItemContainer object of the
# related content item, so only create one for other content items
Modified: CMF/trunk/CMFSetup/actions.py
===================================================================
--- CMF/trunk/CMFSetup/actions.py 2005-09-24 20:51:36 UTC (rev 38603)
+++ CMF/trunk/CMFSetup/actions.py 2005-09-24 21:57:54 UTC (rev 38604)
@@ -19,8 +19,9 @@
from Globals import InitializeClass
from Products.PageTemplates.PageTemplateFile import PageTemplateFile
+from Products.CMFCore.interfaces import IActionProvider
from Products.CMFCore.interfaces.portal_actions \
- import ActionProvider as IActionProvider
+ import ActionProvider as z2IActionProvider
from Products.CMFCore.utils import getToolByName
from permissions import ManagePortal
@@ -174,8 +175,10 @@
class ActionProvidersConfigurator(ConfiguratorBase):
+
""" Synthesize XML description of site's action providers.
"""
+
security = ClassSecurityInfo()
security.declareProtected( ManagePortal, 'listProviderInfo' )
@@ -193,7 +196,8 @@
provider = getToolByName( self._site, provider_id )
- if not IActionProvider.isImplementedBy( provider ):
+ if not IActionProvider.providedBy(provider) and \
+ not z2IActionProvider.isImplementedBy(provider):
continue
if provider_id == 'portal_actions':
More information about the CMF-checkins
mailing list