[CMF-checkins] SVN: CMF/branches/jens_tools_as_utilities/CMF - checkpoint checkin with portal_types done

Jens Vagelpohl jens at dataflake.org
Wed Dec 27 16:00:46 EST 2006


Log message for revision 71656:
  - checkpoint checkin with portal_types done
  

Changed:
  U   CMF/branches/jens_tools_as_utilities/CMFCalendar/browser/event.txt
  U   CMF/branches/jens_tools_as_utilities/CMFCalendar/tests/test_Calendar.py
  U   CMF/branches/jens_tools_as_utilities/CMFCore/ContentTypeRegistry.py
  U   CMF/branches/jens_tools_as_utilities/CMFCore/DiscussionTool.py
  U   CMF/branches/jens_tools_as_utilities/CMFCore/DynamicType.py
  U   CMF/branches/jens_tools_as_utilities/CMFCore/PortalFolder.py
  U   CMF/branches/jens_tools_as_utilities/CMFCore/TypesTool.py
  U   CMF/branches/jens_tools_as_utilities/CMFCore/WorkflowTool.py
  U   CMF/branches/jens_tools_as_utilities/CMFCore/exportimport/content.py
  U   CMF/branches/jens_tools_as_utilities/CMFCore/exportimport/tests/test_content.py
  U   CMF/branches/jens_tools_as_utilities/CMFCore/exportimport/tests/test_typeinfo.py
  U   CMF/branches/jens_tools_as_utilities/CMFCore/exportimport/typeinfo.py
  U   CMF/branches/jens_tools_as_utilities/CMFCore/tests/test_CachingPolicyManager.py
  U   CMF/branches/jens_tools_as_utilities/CMFCore/tests/test_DynamicType.py
  U   CMF/branches/jens_tools_as_utilities/CMFCore/tests/test_OpaqueItems.py
  U   CMF/branches/jens_tools_as_utilities/CMFCore/tests/test_PortalContent.py
  U   CMF/branches/jens_tools_as_utilities/CMFCore/tests/test_PortalFolder.py
  U   CMF/branches/jens_tools_as_utilities/CMFCore/tests/test_WorkflowTool.py
  U   CMF/branches/jens_tools_as_utilities/CMFDefault/DiscussionTool.py
  U   CMF/branches/jens_tools_as_utilities/CMFDefault/browser/folder.txt
  U   CMF/branches/jens_tools_as_utilities/CMFDefault/profiles/default/componentregistry.xml
  U   CMF/branches/jens_tools_as_utilities/CMFDefault/skins/zpt_generic/search_form.py
  U   CMF/branches/jens_tools_as_utilities/CMFDefault/tests/test_DiscussionReply.py
  U   CMF/branches/jens_tools_as_utilities/CMFDefault/tests/test_DiscussionTool.py
  U   CMF/branches/jens_tools_as_utilities/CMFDefault/tests/test_Discussions.py
  U   CMF/branches/jens_tools_as_utilities/CMFDefault/tests/test_Image.py
  U   CMF/branches/jens_tools_as_utilities/CMFDefault/tests/test_Portal.py
  U   CMF/branches/jens_tools_as_utilities/CMFDefault/tests/test_SyndicationTool.py
  U   CMF/branches/jens_tools_as_utilities/CMFTopic/tests/test_DateC.py
  U   CMF/branches/jens_tools_as_utilities/CMFTopic/tests/test_Topic.py

-=-
Modified: CMF/branches/jens_tools_as_utilities/CMFCalendar/browser/event.txt
===================================================================
--- CMF/branches/jens_tools_as_utilities/CMFCalendar/browser/event.txt	2006-12-26 22:12:16 UTC (rev 71655)
+++ CMF/branches/jens_tools_as_utilities/CMFCalendar/browser/event.txt	2006-12-27 21:00:43 UTC (rev 71656)
@@ -9,14 +9,16 @@
     >>> uf = app.site.acl_users
     >>> uf._doAddUser('mgr', 'mgrpw', ['Manager'], [])
 
-Register the portal_properties tool
+Register the minimum number of utilities we need
 
     >>> from zope.component import getSiteManager
     >>> from Products.CMFCore.interfaces import IPropertiesTool
     >>> from Products.CMFCore.interfaces import ISkinsTool
+    >>> from Products.CMFCore.interfaces import ITypesTool
     >>> sm = getSiteManager()
     >>> sm.registerUtility(app.site.portal_properties, IPropertiesTool)
     >>> sm.registerUtility(app.site.portal_skins, ISkinsTool)
+    >>> sm.registerUtility(app.site.portal_types, ITypesTool)
 
 Create the browser object we'll be using.
 

Modified: CMF/branches/jens_tools_as_utilities/CMFCalendar/tests/test_Calendar.py
===================================================================
--- CMF/branches/jens_tools_as_utilities/CMFCalendar/tests/test_Calendar.py	2006-12-26 22:12:16 UTC (rev 71655)
+++ CMF/branches/jens_tools_as_utilities/CMFCalendar/tests/test_Calendar.py	2006-12-27 21:00:43 UTC (rev 71656)
@@ -32,6 +32,7 @@
 from Products.CMFCore.interfaces import IMembershipTool
 from Products.CMFCore.interfaces import IPropertiesTool
 from Products.CMFCore.interfaces import ISkinsTool
+from Products.CMFCore.interfaces import ITypesTool
 from Products.CMFCalendar.testing import FunctionalLayer
 
 
@@ -127,6 +128,7 @@
         sm.registerUtility(self.app.site.portal_membership, IMembershipTool)
         sm.registerUtility(self.app.site.portal_properties, IPropertiesTool)
         sm.registerUtility(self.app.site.portal_skins, ISkinsTool)
+        sm.registerUtility(self.app.site.portal_types, ITypesTool)
 
     def _testURL(self, url, params=None):
         obj = self.app.site.restrictedTraverse(url)

Modified: CMF/branches/jens_tools_as_utilities/CMFCore/ContentTypeRegistry.py
===================================================================
--- CMF/branches/jens_tools_as_utilities/CMFCore/ContentTypeRegistry.py	2006-12-26 22:12:16 UTC (rev 71655)
+++ CMF/branches/jens_tools_as_utilities/CMFCore/ContentTypeRegistry.py	2006-12-27 21:00:43 UTC (rev 71656)
@@ -23,17 +23,19 @@
 from Globals import PersistentMapping
 from OFS.SimpleItem import SimpleItem
 from ZPublisher.mapply import mapply
+
+from zope.component import getUtility
 from zope.interface import implements
 
 from interfaces import IContentTypeRegistry
 from interfaces import IContentTypeRegistryPredicate
+from interfaces import ITypesTool
 from interfaces.ContentTypeRegistry \
         import ContentTypeRegistry as z2IContentTypeRegistry
 from interfaces.ContentTypeRegistry \
         import ContentTypeRegistryPredicate as z2IContentTypeRegistryPredicate
 from permissions import ManagePortal
 from utils import _dtmldir
-from utils import getToolByName
 from utils import registerToolInterface
 
 
@@ -437,7 +439,7 @@
         if typeName is None:
             typeName = '<unknown>'
         else:
-            types_tool = getToolByName(self, 'portal_types')
+            types_tool = getUtility(ITypesTool)
             typeName = types_tool.getTypeInfo(typeName).Title()
         REQUEST[ 'RESPONSE' ].redirect( self.absolute_url()
                                + '/manage_testRegistry'

Modified: CMF/branches/jens_tools_as_utilities/CMFCore/DiscussionTool.py
===================================================================
--- CMF/branches/jens_tools_as_utilities/CMFCore/DiscussionTool.py	2006-12-26 22:12:16 UTC (rev 71655)
+++ CMF/branches/jens_tools_as_utilities/CMFCore/DiscussionTool.py	2006-12-27 21:00:43 UTC (rev 71656)
@@ -32,11 +32,11 @@
 from interfaces import IMembershipTool
 from interfaces import IOldstyleDiscussable
 from interfaces import IOldstyleDiscussionTool
+from interfaces import ITypesTool
 from interfaces.Discussions import OldDiscussable as z2IOldstyleDiscussable
 from interfaces.portal_discussion \
         import oldstyle_portal_discussion as z2IOldstyleDiscussionTool
 from utils import _dtmldir
-from utils import getToolByName
 from utils import UniqueObject
 
 
@@ -159,7 +159,7 @@
         '''
         if hasattr( content, 'allow_discussion' ):
             return content.allow_discussion
-        typeInfo = getToolByName(self, 'portal_types').getTypeInfo( content )
+        typeInfo = getUtility(ITypesTool).getTypeInfo( content )
         if typeInfo:
             return typeInfo.allowDiscussion()
         return 0

Modified: CMF/branches/jens_tools_as_utilities/CMFCore/DynamicType.py
===================================================================
--- CMF/branches/jens_tools_as_utilities/CMFCore/DynamicType.py	2006-12-26 22:12:16 UTC (rev 71655)
+++ CMF/branches/jens_tools_as_utilities/CMFCore/DynamicType.py	2006-12-27 21:00:43 UTC (rev 71656)
@@ -19,9 +19,12 @@
 
 from AccessControl import ClassSecurityInfo
 from Globals import InitializeClass
+
+from zope.component import queryUtility
 from zope.interface import implements
 
 from interfaces import IDynamicType
+from interfaces import ITypesTool
 from interfaces.Dynamic import DynamicType as z2IDynamicType
 from utils import getToolByName
 
@@ -64,10 +67,10 @@
     def getTypeInfo(self):
         """ Get the TypeInformation object specified by the portal type.
         """
-        tool = getToolByName(self, 'portal_types', None)
+        tool = queryUtility(ITypesTool)
         if tool is None:
             return None
-        return tool.getTypeInfo(self)  # Can return None.
+        return tool.__of__(self).getTypeInfo(self)  # Can return None.
 
     security.declarePublic('getActionInfo')
     def getActionInfo(self, action_chain, check_visibility=0,

Modified: CMF/branches/jens_tools_as_utilities/CMFCore/PortalFolder.py
===================================================================
--- CMF/branches/jens_tools_as_utilities/CMFCore/PortalFolder.py	2006-12-26 22:12:16 UTC (rev 71655)
+++ CMF/branches/jens_tools_as_utilities/CMFCore/PortalFolder.py	2006-12-27 21:00:43 UTC (rev 71656)
@@ -26,6 +26,7 @@
 from OFS.OrderSupport import OrderSupport
 from OFS.Folder import Folder
 
+from zope.component import getUtility
 from zope.component import queryUtility
 from zope.component.factory import Factory
 from zope.interface import implements
@@ -38,6 +39,7 @@
 from interfaces import IContentTypeRegistry
 from interfaces import IFolderish
 from interfaces import IMutableMinimalDublinCore
+from interfaces import ITypesTool
 from interfaces.Folderish import Folderish as z2IFolderish
 from permissions import AddPortalContent
 from permissions import AddPortalFolders
@@ -47,7 +49,6 @@
 from permissions import ManageProperties
 from permissions import View
 from utils import _checkPermission
-from utils import getToolByName
 
 
 class PortalFolderBase(DynamicType, CMFCatalogAware, Folder):
@@ -124,7 +125,7 @@
             this folder.
         """
         result = []
-        portal_types = getToolByName(self, 'portal_types')
+        portal_types = getUtility(ITypesTool)
         myType = portal_types.getTypeInfo(self)
 
         if myType is not None:
@@ -152,7 +153,7 @@
         pt = filt.get('portal_type', [])
         if isinstance(pt, basestring):
             pt = [pt]
-        types_tool = getToolByName(self, 'portal_types')
+        types_tool = getUtility(ITypesTool)
         allowed_types = types_tool.listContentTypes()
         if not pt:
             pt = allowed_types
@@ -302,7 +303,7 @@
     def invokeFactory(self, type_name, id, RESPONSE=None, *args, **kw):
         """ Invokes the portal_types tool.
         """
-        pt = getToolByName(self, 'portal_types')
+        pt = getUtility(ITypesTool)
         myType = pt.getTypeInfo(self)
 
         if myType is not None:
@@ -422,7 +423,7 @@
 
             if type_name is not None:
 
-                pt = getToolByName(self, 'portal_types')
+                pt = getUtility(ITypesTool)
                 myType = pt.getTypeInfo(self)
 
                 if myType is not None and not myType.allowType(type_name):

Modified: CMF/branches/jens_tools_as_utilities/CMFCore/TypesTool.py
===================================================================
--- CMF/branches/jens_tools_as_utilities/CMFCore/TypesTool.py	2006-12-26 22:12:16 UTC (rev 71655)
+++ CMF/branches/jens_tools_as_utilities/CMFCore/TypesTool.py	2006-12-27 21:00:43 UTC (rev 71656)
@@ -50,6 +50,7 @@
 from utils import _dtmldir
 from utils import _wwwdir
 from utils import getToolByName
+from utils import registerToolInterface
 from utils import SimpleItemWithProperties
 from utils import UniqueObject
 
@@ -744,3 +745,5 @@
         return rval
 
 InitializeClass(TypesTool)
+registerToolInterface('portal_types', ITypesTool)
+

Modified: CMF/branches/jens_tools_as_utilities/CMFCore/WorkflowTool.py
===================================================================
--- CMF/branches/jens_tools_as_utilities/CMFCore/WorkflowTool.py	2006-12-26 22:12:16 UTC (rev 71655)
+++ CMF/branches/jens_tools_as_utilities/CMFCore/WorkflowTool.py	2006-12-27 21:00:43 UTC (rev 71656)
@@ -24,16 +24,18 @@
 from Globals import PersistentMapping
 from OFS.Folder import Folder
 from OFS.ObjectManager import IFAwareObjectManager
+
+from zope.component import queryUtility
 from zope.interface import implements
 
 from ActionProviderBase import ActionProviderBase
 from interfaces import IConfigurableWorkflowTool
+from interfaces import ITypesTool
 from interfaces import IWorkflowDefinition
 from interfaces import IWorkflowTool
 from interfaces.portal_workflow import portal_workflow as z2IWorkflowTool
 from permissions import ManagePortal
 from utils import _dtmldir
-from utils import getToolByName
 from utils import Message as _
 from utils import UniqueObject
 from WorkflowCore import ObjectDeleted
@@ -461,7 +463,7 @@
     def getDefaultChainFor(self, ob):
         """ Get the default chain, if applicable, for ob.
         """
-        types_tool = getToolByName( self, 'portal_types', None )
+        types_tool = queryUtility(ITypesTool)
         if ( types_tool is not None
             and types_tool.getTypeInfo( ob ) is not None ):
             return self._default_chain
@@ -501,7 +503,7 @@
 
         """ List the portal types which are available.
         """
-        pt = getToolByName(self, 'portal_types', None)
+        pt = queryUtility(ITypesTool)
         if pt is None:
             return ()
         else:

Modified: CMF/branches/jens_tools_as_utilities/CMFCore/exportimport/content.py
===================================================================
--- CMF/branches/jens_tools_as_utilities/CMFCore/exportimport/content.py	2006-12-26 22:12:16 UTC (rev 71655)
+++ CMF/branches/jens_tools_as_utilities/CMFCore/exportimport/content.py	2006-12-27 21:00:43 UTC (rev 71656)
@@ -21,14 +21,14 @@
 from ConfigParser import ConfigParser
 from StringIO import StringIO
 
+from zope.component import getUtility
 from zope.interface import implements
 from zope.interface import directlyProvides
 
 from Products.GenericSetup.interfaces import IFilesystemExporter
 from Products.GenericSetup.interfaces import IFilesystemImporter
 from Products.GenericSetup.content import _globtest
-from Products.CMFCore.utils import getToolByName
-
+from Products.CMFCore.interfaces import ITypesTool
 #
 #   setup_tool handlers
 #
@@ -181,7 +181,7 @@
         context = self.context
         properties = import_context.readDataFile('.properties',
                                                  '%s/%s' % (subdir, id))
-        tool = getToolByName(context, 'portal_types')
+        tool = getUtility(ITypesTool).__of__(context)
 
         try:
             tool.constructContent(portal_type, context, id)

Modified: CMF/branches/jens_tools_as_utilities/CMFCore/exportimport/tests/test_content.py
===================================================================
--- CMF/branches/jens_tools_as_utilities/CMFCore/exportimport/tests/test_content.py	2006-12-26 22:12:16 UTC (rev 71655)
+++ CMF/branches/jens_tools_as_utilities/CMFCore/exportimport/tests/test_content.py	2006-12-27 21:00:43 UTC (rev 71656)
@@ -22,8 +22,10 @@
 from ConfigParser import ConfigParser
 from StringIO import StringIO
 
+from zope.component import getSiteManager
 from zope.testing.cleanup import cleanUp
 
+from Products.CMFCore.interfaces import ITypesTool
 from Products.GenericSetup.tests.common import DummyExportContext
 from Products.GenericSetup.tests.common import DummyImportContext
 
@@ -750,7 +752,9 @@
     folder = PortalFolder(id)
     folder.portal_type = TEST_FOLDER
     if site_folder:
+        sm = getSiteManager()
         tool = folder.portal_types = TypesTool()
+        sm.registerUtility(tool, ITypesTool)
         tool._setObject(TEST_CSV_AWARE, _TypeInfo(TEST_CSV_AWARE))
         tool._setObject(TEST_INI_AWARE, _TypeInfo(TEST_INI_AWARE))
         tool._setObject(TEST_CONTENT, _TypeInfo(TEST_CONTENT))

Modified: CMF/branches/jens_tools_as_utilities/CMFCore/exportimport/tests/test_typeinfo.py
===================================================================
--- CMF/branches/jens_tools_as_utilities/CMFCore/exportimport/tests/test_typeinfo.py	2006-12-26 22:12:16 UTC (rev 71655)
+++ CMF/branches/jens_tools_as_utilities/CMFCore/exportimport/tests/test_typeinfo.py	2006-12-27 21:00:43 UTC (rev 71656)
@@ -20,11 +20,14 @@
 
 from OFS.Folder import Folder
 
+from zope.component import getSiteManager
+
 from Products.GenericSetup.testing import BodyAdapterTestCase
 from Products.GenericSetup.tests.common import BaseRegistryTests
 from Products.GenericSetup.tests.common import DummyExportContext
 from Products.GenericSetup.tests.common import DummyImportContext
 
+from Products.CMFCore.interfaces import ITypesTool
 from Products.CMFCore.permissions import View
 from Products.CMFCore.permissions import AccessContentsInformation
 from Products.CMFCore.permissions import ModifyPortalContent
@@ -325,6 +328,9 @@
         site = self.root.site
         ttool = site.portal_types = TypesTool()
 
+        sm = getSiteManager()
+        sm.registerUtility(ttool, ITypesTool)
+
         if foo == 1:
             fti = _TI_LIST[0].copy()
             ttool._setObject(fti['id'], FactoryTypeInformation(**fti))

Modified: CMF/branches/jens_tools_as_utilities/CMFCore/exportimport/typeinfo.py
===================================================================
--- CMF/branches/jens_tools_as_utilities/CMFCore/exportimport/typeinfo.py	2006-12-26 22:12:16 UTC (rev 71655)
+++ CMF/branches/jens_tools_as_utilities/CMFCore/exportimport/typeinfo.py	2006-12-27 21:00:43 UTC (rev 71656)
@@ -16,6 +16,7 @@
 """
 
 from zope.component import adapts
+from zope.component import getSiteManager
 
 from Products.GenericSetup.interfaces import ISetupEnviron
 from Products.GenericSetup.utils import exportObjects
@@ -177,16 +178,16 @@
 def importTypesTool(context):
     """Import types tool and content types from XML files.
     """
-    site = context.getSite()
-    tool = getToolByName(site, 'portal_types')
+    sm = getSiteManager(context.getSite())
+    tool = sm.getUtility(ITypesTool)
 
     importObjects(tool, '', context)
 
 def exportTypesTool(context):
     """Export types tool content types as a set of XML files.
     """
-    site = context.getSite()
-    tool = getToolByName(site, 'portal_types', None)
+    sm = getSiteManager(context.getSite())
+    tool = sm.queryUtility(ITypesTool)
     if tool is None:
         logger = context.getLogger('types')
         logger.info('Nothing to export.')

Modified: CMF/branches/jens_tools_as_utilities/CMFCore/tests/test_CachingPolicyManager.py
===================================================================
--- CMF/branches/jens_tools_as_utilities/CMFCore/tests/test_CachingPolicyManager.py	2006-12-26 22:12:16 UTC (rev 71655)
+++ CMF/branches/jens_tools_as_utilities/CMFCore/tests/test_CachingPolicyManager.py	2006-12-27 21:00:43 UTC (rev 71656)
@@ -33,6 +33,7 @@
 
 from Products.CMFCore.FSPageTemplate import FSPageTemplate
 from Products.CMFCore.FSDTMLMethod import FSDTMLMethod
+from Products.CMFCore.interfaces import ITypesTool
 from Products.CMFCore.testing import FunctionalZCMLLayer
 from Products.CMFCore.testing import TraversingZCMLLayer
 from Products.CMFCore.tests.base.dummy import DummyContent
@@ -656,8 +657,10 @@
         now = DateTime()
 
         # Create a fake portal and the tools we need
+        sm = getSiteManager()
         self.portal = DummySite(id='portal').__of__(self.root)
         self.portal._setObject('portal_types', DummyTool())
+        sm.registerUtility(self.portal.portal_types, ITypesTool)
 
         # This is a FSPageTemplate that will be used as the View for
         # our content objects. It doesn't matter what it returns.

Modified: CMF/branches/jens_tools_as_utilities/CMFCore/tests/test_DynamicType.py
===================================================================
--- CMF/branches/jens_tools_as_utilities/CMFCore/tests/test_DynamicType.py	2006-12-26 22:12:16 UTC (rev 71655)
+++ CMF/branches/jens_tools_as_utilities/CMFCore/tests/test_DynamicType.py	2006-12-27 21:00:43 UTC (rev 71656)
@@ -26,6 +26,7 @@
 
 from Products.CMFCore.DynamicType import DynamicType
 from Products.CMFCore.interfaces import IMembershipTool
+from Products.CMFCore.interfaces import ITypesTool
 from Products.CMFCore.tests.base.dummy import DummyObject
 from Products.CMFCore.tests.base.dummy import DummySite
 from Products.CMFCore.tests.base.dummy import DummyTool
@@ -45,8 +46,10 @@
 class DynamicTypeTests(unittest.TestCase):
 
     def setUp(self):
+        sm = getSiteManager()
         self.site = DummySite('site')
         self.site._setObject( 'portal_types', TypesTool() )
+        sm.registerUtility(self.site.portal_types, ITypesTool)
         fti = FTIDATA_CMF15[0].copy()
         self.site.portal_types._setObject( 'Dummy Content 15', FTI(**fti) )
         self.site._setObject( 'foo', DummyContent() )
@@ -91,6 +94,7 @@
         self.site._setObject( 'portal_membership', DummyTool() )
         sm.registerUtility(self.site.portal_membership, IMembershipTool)
         self.site._setObject( 'portal_types', TypesTool() )
+        sm.registerUtility(self.site.portal_types, ITypesTool)
         self.site._setObject( 'portal_url', DummyTool() )
         fti = FTIDATA_CMF15[0].copy()
         self.site.portal_types._setObject( 'Dummy Content 15', FTI(**fti) )

Modified: CMF/branches/jens_tools_as_utilities/CMFCore/tests/test_OpaqueItems.py
===================================================================
--- CMF/branches/jens_tools_as_utilities/CMFCore/tests/test_OpaqueItems.py	2006-12-26 22:12:16 UTC (rev 71655)
+++ CMF/branches/jens_tools_as_utilities/CMFCore/tests/test_OpaqueItems.py	2006-12-27 21:00:43 UTC (rev 71656)
@@ -18,11 +18,13 @@
 import unittest
 import Testing
 
+from zope.component import getSiteManager
 from zope.interface import implements
 
 from Products.CMFCore.interfaces import ICallableOpaqueItem
 from Products.CMFCore.interfaces import ICallableOpaqueItemEvents
 from Products.CMFCore.interfaces import IContentish
+from Products.CMFCore.interfaces import ITypesTool
 from Products.CMFCore.interfaces.IOpaqueItems \
         import ICallableOpaqueItem as z2ICallableOpaqueItem
 from Products.CMFCore.interfaces.IOpaqueItems \
@@ -146,9 +148,11 @@
         SecurityTest.setUp(self)
 
         root = self.root
+        sm = getSiteManager()
 
         # setting up types tool
         root._setObject( 'portal_types', TypesTool() )
+        sm.registerUtility(root.portal_types, ITypesTool)
 
         # setup portal
         try:

Modified: CMF/branches/jens_tools_as_utilities/CMFCore/tests/test_PortalContent.py
===================================================================
--- CMF/branches/jens_tools_as_utilities/CMFCore/tests/test_PortalContent.py	2006-12-26 22:12:16 UTC (rev 71655)
+++ CMF/branches/jens_tools_as_utilities/CMFCore/tests/test_PortalContent.py	2006-12-27 21:00:43 UTC (rev 71656)
@@ -22,7 +22,10 @@
 from Acquisition import aq_base
 from OFS.Folder import Folder
 
+from zope.component import getSiteManager
+
 from Products.CMFCore.exceptions import NotFound
+from Products.CMFCore.interfaces import ITypesTool
 from Products.CMFCore.testing import TraversingEventZCMLLayer
 from Products.CMFCore.tests.base.dummy import DummyContent
 from Products.CMFCore.tests.base.dummy import DummyObject
@@ -55,11 +58,14 @@
         verifyClass(IDynamicType, PortalContent)
 
     def _setupCallTests(self, aliases):
+        sm = getSiteManager()
+
         # root
         root = Folder( 'root' )
 
         # set up dummy type info with problematic double-default alias
         root._setObject( 'portal_types', DummyTool() )
+        sm.registerUtility(root.portal_types, ITypesTool)
         root.portal_types._type_actions = aliases
 
         # dummy content and skin

Modified: CMF/branches/jens_tools_as_utilities/CMFCore/tests/test_PortalFolder.py
===================================================================
--- CMF/branches/jens_tools_as_utilities/CMFCore/tests/test_PortalFolder.py	2006-12-26 22:12:16 UTC (rev 71655)
+++ CMF/branches/jens_tools_as_utilities/CMFCore/tests/test_PortalFolder.py	2006-12-27 21:00:43 UTC (rev 71656)
@@ -30,10 +30,12 @@
 from zope.component import getGlobalSiteManager
 from zope.component import getSiteManager
 from zope.component.interfaces import IFactory
+from zope.interface import implements
 
 from Products.CMFCore.CatalogTool import CatalogTool
 from Products.CMFCore.exceptions import BadRequest
 from Products.CMFCore.interfaces import ICatalogTool
+from Products.CMFCore.interfaces import ITypesTool
 from Products.CMFCore.testing import ConformsToFolder
 from Products.CMFCore.testing import FunctionalZCMLLayer
 from Products.CMFCore.testing import TraversingEventZCMLLayer
@@ -77,6 +79,7 @@
         newSecurityManager(None, acl_users.all_powerful_Oz)
 
         ttool = self.site._setObject('portal_types', TypesTool())
+        gsm.registerUtility(self.site.portal_types, ITypesTool)
         ttool._setObject(self._PORTAL_TYPE,
                          FTI(id=self._PORTAL_TYPE,
                              title='Folder or Directory',
@@ -148,7 +151,9 @@
         verifyClass(IOrderedContainer, self._getTargetClass())
 
     def test_contents_methods(self):
+        sm = getSiteManager()
         ttool = self.site._setObject( 'portal_types', TypesTool() )
+        sm.registerUtility(ttool, ITypesTool)
         f = self._makeOne('foo')
         self.assertEqual( f.objectValues(), [] )
         self.assertEqual( f.contentIds(), [] )
@@ -223,6 +228,7 @@
         sm = getSiteManager(self.site)
         test = self._makeOne('test')
         ttool = self.site._setObject( 'portal_types', TypesTool() )
+        sm.registerUtility(ttool, ITypesTool)
         ctool = self.site._setObject( 'portal_catalog', CatalogTool() )
         sm.registerUtility(ctool, ICatalogTool)
         self.assertEqual( len(ctool), 0 )
@@ -246,6 +252,7 @@
         #
         sm = getSiteManager(self.site)
         ttool = self.site._setObject( 'portal_types', TypesTool() )
+        sm.registerUtility(ttool, ITypesTool)
         ctool = self.site._setObject( 'portal_catalog', CatalogTool() )
         sm.registerUtility(ctool, ICatalogTool)
         wftool = self.site._setObject( 'portal_workflow', WorkflowTool() )
@@ -264,6 +271,7 @@
         sm = getSiteManager(self.site)
         test = self._makeOne('test')
         ttool = self.site._setObject( 'portal_types', TypesTool() )
+        sm.registerUtility(ttool, ITypesTool)
         ctool = self.site._setObject( 'portal_catalog', CatalogTool() )
         sm.registerUtility(ctool, ICatalogTool)
         self.assertEqual( len(ctool), 0 )
@@ -290,9 +298,11 @@
         #
         from Products.CMFCore.PortalFolder import PortalFolder
 
+        sm = getSiteManager()
         test = self._makeOne('test')
 
         ttool = self.site._setObject( 'portal_types', TypesTool() )
+        sm.registerUtility(ttool, ITypesTool)
         ttool._setObject( 'Folder'
                         , FTI( id='Folder'
                              , title='Folder or Directory'
@@ -343,7 +353,9 @@
         #
         #   _verifyObjectPaste() should honor allowed content types
         #
+        sm = getSiteManager()
         ttool = self.site._setObject( 'portal_types', TypesTool() )
+        sm.registerUtility(ttool, ITypesTool)
         fti = FTIDATA_DUMMY[0].copy()
         ttool._setObject( 'Dummy Content', FTI(**fti) )
         ttool._setObject( 'Folder', FTI(**fti) )
@@ -391,9 +403,11 @@
         self.assertRaises(BadRequest, test._checkId, 'acl_users')
 
     def test__checkId_MethodAlias(self):
+        sm = getSiteManager()
         test = self._makeOne('test')
         test._setPortalTypeName('Dummy Content 15')
         ttool = self.site._setObject('portal_types', TypesTool())
+        sm.registerUtility(self.site.portal_types, ITypesTool)
         ttool._setObject('Dummy Content 15', FTI(**FTIDATA_CMF15[0]))
         acl_users = self.site._setObject('acl_users', DummyUserFolder())
         test._checkId('view.html')
@@ -454,6 +468,7 @@
 
         sm = getSiteManager(self.site)
         ttool = self.site._setObject( 'portal_types', TypesTool() )
+        sm.registerUtility(ttool, ITypesTool)
         ctool = self.site._setObject( 'portal_catalog', CatalogTool() )
         sm.registerUtility(ctool, ICatalogTool)
         ctool.addIndex('getId', 'FieldIndex')
@@ -504,6 +519,7 @@
         ctool = self.site._setObject( 'portal_catalog', CatalogTool() )
         sm.registerUtility(ctool, ICatalogTool)
         ttool = self.site._setObject( 'portal_types', TypesTool() )
+        sm.registerUtility(ttool, ITypesTool)
         fti = FTIDATA_DUMMY[0].copy()
         ttool._setObject( 'Dummy Content', FTI(**fti) )
         sub1 = self._makeOne('sub1')
@@ -1069,6 +1085,7 @@
         from AccessControl.Permissions import delete_objects as DeleteObjects
         from Products.CMFCore.PortalFolder import PortalFolder
 
+        sm = getSiteManager()
         folder1, folder2 = self._initFolders()
         folder1.manage_permission( DeleteObjects, roles=(), acquire=0 )
 
@@ -1076,6 +1093,7 @@
         transaction.savepoint(optimistic=True) # get a _p_jar for 'sub'
 
         self.app.portal_types = DummyTypesTool()
+        sm.registerUtility(self.app.portal_types, ITypesTool)
 
         def _no_delete_objects(permission, object, context):
             return permission != DeleteObjects
@@ -1102,11 +1120,13 @@
         folder1, folder2 = self._initFolders()
         folder1.portal_type = UNRESTRICTED_TYPE
         folder2.portal_type = RESTRICTED_TYPE
+        sm = getSiteManager()
 
         self._initPolicyAndUser() # ensure that sec. machinery allows paste
 
         self.app._setObject( 'portal_types', TypesTool() )
         types_tool = self.app.portal_types
+        sm.registerUtility(types_tool, ITypesTool)
         types_tool._setObject( RESTRICTED_TYPE
                              , FTI( id=RESTRICTED_TYPE
                                   , title=RESTRICTED_TYPE
@@ -1147,11 +1167,13 @@
         folder1, folder2 = self._initFolders()
         folder1.portal_type = UNRESTRICTED_TYPE
         folder2.portal_type = RESTRICTED_TYPE
+        sm = getSiteManager()
 
         self._initPolicyAndUser() # ensure that sec. machinery allows paste
 
         self.app._setObject( 'portal_types', TypesTool() )
         types_tool = self.app.portal_types
+        sm.registerUtility(types_tool, ITypesTool)
         types_tool._setObject( RESTRICTED_TYPE
                              , FTI( id=RESTRICTED_TYPE
                                   , title=RESTRICTED_TYPE
@@ -1191,11 +1213,13 @@
         folder1, folder2 = self._initFolders()
         folder1.portal_type = RESTRICTED_TYPE
         folder2.portal_type = UNRESTRICTED_TYPE
+        sm = getSiteManager()
 
         self._initPolicyAndUser() # ensure that sec. machinery allows paste
 
         self.app._setObject( 'portal_types', TypesTool() )
         types_tool = self.app.portal_types
+        sm.registerUtility(types_tool, ITypesTool)
         types_tool._setObject( RESTRICTED_TYPE
                              , FTI( id=RESTRICTED_TYPE
                                   , title=RESTRICTED_TYPE
@@ -1231,6 +1255,8 @@
 
 class DummyTypesTool( Implicit ):
 
+    implements(ITypesTool)
+
     def getTypeInfo( self, portal_type ):
 
         return DummyTypeInfo()

Modified: CMF/branches/jens_tools_as_utilities/CMFCore/tests/test_WorkflowTool.py
===================================================================
--- CMF/branches/jens_tools_as_utilities/CMFCore/tests/test_WorkflowTool.py	2006-12-26 22:12:16 UTC (rev 71655)
+++ CMF/branches/jens_tools_as_utilities/CMFCore/tests/test_WorkflowTool.py	2006-12-27 21:00:43 UTC (rev 71656)
@@ -20,7 +20,11 @@
 
 from OFS.SimpleItem import SimpleItem
 
+from zope.component import getSiteManager
 
+from Products.CMFCore.interfaces import ITypesTool
+
+
 class Dummy( SimpleItem ):
 
     def __init__( self, id ):
@@ -144,9 +148,11 @@
     def _makeRoot( self ):
 
         from OFS.Folder import Folder
+        sm = getSiteManager()
         root = Folder( 'root' )
         tt = DummyTypesTool()
         root._setObject( 'portal_types', tt )
+        sm.registerUtility(root.portal_types, ITypesTool)
         return root
 
     def _makeWithTypes( self ):

Modified: CMF/branches/jens_tools_as_utilities/CMFDefault/DiscussionTool.py
===================================================================
--- CMF/branches/jens_tools_as_utilities/CMFDefault/DiscussionTool.py	2006-12-26 22:12:16 UTC (rev 71655)
+++ CMF/branches/jens_tools_as_utilities/CMFDefault/DiscussionTool.py	2006-12-27 21:00:43 UTC (rev 71656)
@@ -28,11 +28,11 @@
 from Products.CMFCore.interfaces import IDiscussionResponse
 from Products.CMFCore.interfaces import IDiscussionTool
 from Products.CMFCore.interfaces import IMembershipTool
+from Products.CMFCore.interfaces import ITypesTool
 from Products.CMFCore.interfaces.Discussions \
         import DiscussionResponse as z2IDiscussionResponse
 from Products.CMFCore.interfaces.portal_discussion \
         import portal_discussion as z2IDiscussionTool
-from Products.CMFCore.utils import getToolByName
 from Products.CMFCore.utils import registerToolInterface
 from Products.CMFCore.utils import UniqueObject
 
@@ -109,7 +109,7 @@
         """
         if hasattr( aq_base(content), 'allow_discussion' ):
             return bool(content.allow_discussion)
-        typeInfo = getToolByName(self, 'portal_types').getTypeInfo( content )
+        typeInfo = getUtility(ITypesTool).getTypeInfo( content )
         if typeInfo:
             return bool( typeInfo.allowDiscussion() )
         return False

Modified: CMF/branches/jens_tools_as_utilities/CMFDefault/browser/folder.txt
===================================================================
--- CMF/branches/jens_tools_as_utilities/CMFDefault/browser/folder.txt	2006-12-26 22:12:16 UTC (rev 71655)
+++ CMF/branches/jens_tools_as_utilities/CMFDefault/browser/folder.txt	2006-12-27 21:00:43 UTC (rev 71656)
@@ -9,9 +9,17 @@
       >>> site = DummySite('site')
 
       >>> from Products.CMFCore.tests.base.dummy import DummyTool
+      >>> from zope.component import getSiteManager
+      >>> from Products.CMFCore.interfaces import IMembershipTool
+      >>> from Products.CMFCore.interfaces import IPropertiesTool
+      >>> from Products.CMFCore.interfaces import ITypesTool
+      >>> sm = getSiteManager()
       >>> mtool = site._setObject('portal_membership', DummyTool())
+      >>> sm.registerUtility(mtool, IMembershipTool)
       >>> ptool = site._setObject('portal_properties', DummyTool())
+      >>> sm.registerUtility(ptool, IPropertiesTool)
       >>> ttool = site._setObject('portal_types', DummyTool())
+      >>> sm.registerUtility(ttool, ITypesTool)
       >>> utool = site._setObject('portal_url', DummyTool())
 
 

Modified: CMF/branches/jens_tools_as_utilities/CMFDefault/profiles/default/componentregistry.xml
===================================================================
--- CMF/branches/jens_tools_as_utilities/CMFDefault/profiles/default/componentregistry.xml	2006-12-26 22:12:16 UTC (rev 71655)
+++ CMF/branches/jens_tools_as_utilities/CMFDefault/profiles/default/componentregistry.xml	2006-12-27 21:00:43 UTC (rev 71656)
@@ -38,5 +38,8 @@
   <utility
      interface="Products.CMFCore.interfaces.ISkinsTool"
      object="/portal_skins"/>
+  <utility
+     interface="Products.CMFCore.interfaces.ITypesTool"
+     object="/portal_types"/>
  </utilities>
 </componentregistry>

Modified: CMF/branches/jens_tools_as_utilities/CMFDefault/skins/zpt_generic/search_form.py
===================================================================
--- CMF/branches/jens_tools_as_utilities/CMFDefault/skins/zpt_generic/search_form.py	2006-12-26 22:12:16 UTC (rev 71655)
+++ CMF/branches/jens_tools_as_utilities/CMFDefault/skins/zpt_generic/search_form.py	2006-12-27 21:00:43 UTC (rev 71656)
@@ -1,13 +1,20 @@
 ##parameters=search=''
 ##
+from Products.CMFCore.utils import getToolByInterfaceName
 from Products.CMFCore.utils import getToolByName
 from Products.CMFDefault.permissions import ReviewPortalContent
 from Products.CMFDefault.utils import decode
 from Products.CMFDefault.utils import Message as _
 
-ctool = getToolByName(script, 'portal_catalog')
-mtool = getToolByName(script, 'portal_membership')
-ttool = getToolByName(script, 'portal_types')
+ctool = getToolByInterfaceName( script
+                              , 'Products.CMFCore.interfaces.ICatalogTool'
+                              )
+mtool = getToolByInterfaceName( script
+                              , 'Products.CMFCore.interfaces.IMembershipTool'
+                              )
+ttool = getToolByInterfaceName( script
+                              , 'Products.CMFCore.interfaces.ITypesTool'
+                              )
 utool = getToolByName(script, 'portal_url')
 portal_url = utool()
 

Modified: CMF/branches/jens_tools_as_utilities/CMFDefault/tests/test_DiscussionReply.py
===================================================================
--- CMF/branches/jens_tools_as_utilities/CMFDefault/tests/test_DiscussionReply.py	2006-12-26 22:12:16 UTC (rev 71655)
+++ CMF/branches/jens_tools_as_utilities/CMFDefault/tests/test_DiscussionReply.py	2006-12-27 21:00:43 UTC (rev 71656)
@@ -23,6 +23,7 @@
 from zope.component import getSiteManager
 
 from Products.CMFCore.interfaces import IMembershipTool
+from Products.CMFCore.interfaces import ITypesTool
 from Products.CMFDefault.testing import FunctionalLayer
 
 
@@ -34,6 +35,7 @@
         self.portal = self.app.site
         sm = getSiteManager()
         sm.registerUtility(self.portal.portal_membership, IMembershipTool)
+        sm.registerUtility(self.portal.portal_types, ITypesTool)
         # Become a Manager
         self.uf = self.portal.acl_users
         self.uf.userFolderAddUser('manager', '', ['Manager'], [])
@@ -68,6 +70,7 @@
         self.portal = self.app.site
         sm = getSiteManager()
         sm.registerUtility(self.portal.portal_membership, IMembershipTool)
+        sm.registerUtility(self.portal.portal_types, ITypesTool)
         DiscussionReplyTest.afterSetUp(self)
         self.uf.userFolderAddUser('member', '', ['Member'], [])
         self.site_login('member')

Modified: CMF/branches/jens_tools_as_utilities/CMFDefault/tests/test_DiscussionTool.py
===================================================================
--- CMF/branches/jens_tools_as_utilities/CMFDefault/tests/test_DiscussionTool.py	2006-12-26 22:12:16 UTC (rev 71655)
+++ CMF/branches/jens_tools_as_utilities/CMFDefault/tests/test_DiscussionTool.py	2006-12-27 21:00:43 UTC (rev 71656)
@@ -22,6 +22,7 @@
 
 from Products.CMFCore.interfaces import IDiscussionTool
 from Products.CMFCore.interfaces import IMembershipTool
+from Products.CMFCore.interfaces import ITypesTool
 from Products.CMFCore.tests.base.dummy import DummyFolder
 from Products.CMFCore.tests.base.dummy import DummySite
 from Products.CMFCore.tests.base.dummy import DummyTool
@@ -42,6 +43,7 @@
         self.site._setObject( 'portal_membership', DummyTool() )
         sm.registerUtility(self.site.portal_membership, IMembershipTool)
         self.site._setObject( 'portal_types', DummyTool() )
+        sm.registerUtility(self.site.portal_types, ITypesTool)
 
     def test_z2interfaces(self):
         from Interface.Verify import verifyClass

Modified: CMF/branches/jens_tools_as_utilities/CMFDefault/tests/test_Discussions.py
===================================================================
--- CMF/branches/jens_tools_as_utilities/CMFDefault/tests/test_Discussions.py	2006-12-26 22:12:16 UTC (rev 71655)
+++ CMF/branches/jens_tools_as_utilities/CMFDefault/tests/test_Discussions.py	2006-12-27 21:00:43 UTC (rev 71656)
@@ -24,6 +24,7 @@
 from Products.CMFCore.interfaces import ICatalogTool
 from Products.CMFCore.interfaces import IDiscussionTool
 from Products.CMFCore.interfaces import IMembershipTool
+from Products.CMFCore.interfaces import ITypesTool
 from Products.CMFCore.testing import EventZCMLLayer
 from Products.CMFCore.tests.base.dummy import DummyContent
 from Products.CMFCore.tests.base.dummy import DummySite
@@ -116,6 +117,7 @@
         self.site._setObject( 'portal_membership', DummyTool() )
         sm.registerUtility(self.site.portal_membership, IMembershipTool)
         self.site._setObject( 'portal_types', TypesTool() )
+        sm.registerUtility(self.site.portal_types, ITypesTool)
 
     def _makeDummyContent(self, id, *args, **kw):
         return self.site._setObject( id, DummyContent(id, *args, **kw) )

Modified: CMF/branches/jens_tools_as_utilities/CMFDefault/tests/test_Image.py
===================================================================
--- CMF/branches/jens_tools_as_utilities/CMFDefault/tests/test_Image.py	2006-12-26 22:12:16 UTC (rev 71655)
+++ CMF/branches/jens_tools_as_utilities/CMFDefault/tests/test_Image.py	2006-12-27 21:00:43 UTC (rev 71656)
@@ -30,6 +30,7 @@
 
 from Products.CMFCore.interfaces import ICachingPolicyManager
 from Products.CMFCore.interfaces import IMembershipTool
+from Products.CMFCore.interfaces import ITypesTool
 from Products.CMFCore.testing import ConformsToContent
 from Products.CMFCore.tests.base.dummy import DummyCachingManager
 from Products.CMFCore.tests.base.dummy import DummyCachingManagerWithPolicy
@@ -115,6 +116,7 @@
         self.site = self.app.site
         sm = getSiteManager()
         sm.registerUtility(self.app.site.portal_membership, IMembershipTool)
+        sm.registerUtility(self.app.site.portal_types, ITypesTool)
         newSecurityManager(None, UnrestrictedUser('god', '', ['Manager'], ''))
 
         self.site.invokeFactory('File', id='file')

Modified: CMF/branches/jens_tools_as_utilities/CMFDefault/tests/test_Portal.py
===================================================================
--- CMF/branches/jens_tools_as_utilities/CMFDefault/tests/test_Portal.py	2006-12-26 22:12:16 UTC (rev 71655)
+++ CMF/branches/jens_tools_as_utilities/CMFDefault/tests/test_Portal.py	2006-12-27 21:00:43 UTC (rev 71656)
@@ -26,6 +26,7 @@
 
 from Products.CMFCore.interfaces import ICatalogTool
 from Products.CMFCore.interfaces import IMembershipTool
+from Products.CMFCore.interfaces import ITypesTool
 from Products.CMFDefault.testing import FunctionalLayer
 
 
@@ -39,6 +40,7 @@
         sm = getSiteManager()
         sm.registerUtility(self.app.site.portal_catalog, ICatalogTool)
         sm.registerUtility(self.app.site.portal_membership, IMembershipTool)
+        sm.registerUtility(self.app.site.portal_types, ITypesTool)
 
     def _makeContent( self, site, portal_type, id='document', **kw ):
         newSecurityManager(None, UnrestrictedUser('god', '', ['Manager'], ''))

Modified: CMF/branches/jens_tools_as_utilities/CMFDefault/tests/test_SyndicationTool.py
===================================================================
--- CMF/branches/jens_tools_as_utilities/CMFDefault/tests/test_SyndicationTool.py	2006-12-26 22:12:16 UTC (rev 71655)
+++ CMF/branches/jens_tools_as_utilities/CMFDefault/tests/test_SyndicationTool.py	2006-12-27 21:00:43 UTC (rev 71656)
@@ -20,6 +20,9 @@
 
 from DateTime.DateTime import DateTime
 
+from zope.component import getSiteManager
+
+from Products.CMFCore.interfaces import ITypesTool
 from Products.CMFCore.tests.base.testcase import SecurityTest
 
 
@@ -163,12 +166,14 @@
         from Products.CMFCore.PortalFolder import PortalFolder
         from Products.CMFCore.CMFBTreeFolder import CMFBTreeFolder
         from Products.CMFCore.TypesTool import TypesTool
+        sm = getSiteManager()
         PERIOD = 'hourly'
         FREQUENCY = 4
         NOW = DateTime()
         MAX_ITEMS = 42
 
         self.root._setObject( 'portal_types', TypesTool() )
+        sm.registerUtility(self.root.portal_types, ITypesTool)
         self.root._setObject('pf', PortalFolder('pf'))
         self.root._setObject('bf', CMFBTreeFolder('bf'))
         self.root._setObject('portal_syndication', self._makeOne())

Modified: CMF/branches/jens_tools_as_utilities/CMFTopic/tests/test_DateC.py
===================================================================
--- CMF/branches/jens_tools_as_utilities/CMFTopic/tests/test_DateC.py	2006-12-26 22:12:16 UTC (rev 71655)
+++ CMF/branches/jens_tools_as_utilities/CMFTopic/tests/test_DateC.py	2006-12-27 21:00:43 UTC (rev 71656)
@@ -23,6 +23,7 @@
 from DateTime.DateTime import DateTime
 
 from Products.CMFCore.interfaces import ICatalogTool
+from Products.CMFCore.interfaces import ITypesTool
 from Products.CMFCore.tests.base.dummy import DummyContent
 from Products.CMFDefault.testing import FunctionalLayer
 from Products.CMFTopic.Topic import Topic
@@ -166,6 +167,7 @@
         self.site = self.app.site
         sm = getSiteManager()
         sm.registerUtility(self.site.portal_catalog, ICatalogTool)
+        sm.registerUtility(self.site.portal_types, ITypesTool)
         self.site._setObject( 'topic', Topic('topic') )
         self.topic = self.site.topic
         self.topic.addCriterion('modified', 'Friendly Date Criterion')

Modified: CMF/branches/jens_tools_as_utilities/CMFTopic/tests/test_Topic.py
===================================================================
--- CMF/branches/jens_tools_as_utilities/CMFTopic/tests/test_Topic.py	2006-12-26 22:12:16 UTC (rev 71655)
+++ CMF/branches/jens_tools_as_utilities/CMFTopic/tests/test_Topic.py	2006-12-27 21:00:43 UTC (rev 71656)
@@ -24,6 +24,7 @@
 from zope.component import getSiteManager
 
 from Products.CMFCore.interfaces import ICatalogTool
+from Products.CMFCore.interfaces import ITypesTool
 from Products.CMFCore.testing import ConformsToFolder
 from Products.CMFCore.testing import EventZCMLLayer
 from Products.CMFCore.tests.base.dummy import DummySite
@@ -201,7 +202,9 @@
         self.assertEqual( query[ 'baz' ], 43 )
 
     def test_Nested( self ):
+        sm = getSiteManager()
         self.site._setObject( 'portal_types', TypesTool() )
+        sm.registerUtility(self.site.portal_types, ITypesTool)
         self.site.portal_types._setObject('Topic', FTI(id='Topic',
                                       product='CMFTopic', factory='addTopic'))
         topic = self._makeOne('top')



More information about the CMF-checkins mailing list