[CMF-checkins] SVN: CMF/branches/jens_tools_as_utilities/CMF - checkpoint checkin, two more tools, but also some failing unit tests

Jens Vagelpohl jens at dataflake.org
Wed Dec 27 17:35:32 EST 2006


Log message for revision 71657:
  - checkpoint checkin, two more tools, but also some failing unit tests
  

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/DynamicType.py
  U   CMF/branches/jens_tools_as_utilities/CMFCore/Expression.py
  U   CMF/branches/jens_tools_as_utilities/CMFCore/MembershipTool.py
  U   CMF/branches/jens_tools_as_utilities/CMFCore/SkinsTool.py
  U   CMF/branches/jens_tools_as_utilities/CMFCore/URLTool.py
  U   CMF/branches/jens_tools_as_utilities/CMFCore/interfaces/_tools.py
  U   CMF/branches/jens_tools_as_utilities/CMFCore/tests/test_ActionProviderBase.py
  U   CMF/branches/jens_tools_as_utilities/CMFCore/tests/test_ActionsTool.py
  U   CMF/branches/jens_tools_as_utilities/CMFCore/tests/test_DynamicType.py
  U   CMF/branches/jens_tools_as_utilities/CMFCore/tests/test_MembershipTool.py
  U   CMF/branches/jens_tools_as_utilities/CMFDefault/Favorite.py
  U   CMF/branches/jens_tools_as_utilities/CMFDefault/SyndicationTool.py
  U   CMF/branches/jens_tools_as_utilities/CMFDefault/browser/favorite.py
  U   CMF/branches/jens_tools_as_utilities/CMFDefault/profiles/default/componentregistry.xml
  U   CMF/branches/jens_tools_as_utilities/CMFDefault/skins/zpt_control/setRedirect.py
  U   CMF/branches/jens_tools_as_utilities/CMFDefault/skins/zpt_generic/RSS.py
  U   CMF/branches/jens_tools_as_utilities/CMFDefault/skins/zpt_generic/breadcrumbs.py
  U   CMF/branches/jens_tools_as_utilities/CMFDefault/skins/zpt_generic/expanded_title.py
  U   CMF/branches/jens_tools_as_utilities/CMFDefault/skins/zpt_generic/folder_contents.py
  U   CMF/branches/jens_tools_as_utilities/CMFDefault/skins/zpt_generic/folder_rename_form.py
  U   CMF/branches/jens_tools_as_utilities/CMFDefault/skins/zpt_generic/getBatchItemInfos.py
  U   CMF/branches/jens_tools_as_utilities/CMFDefault/skins/zpt_generic/getMainGlobals.py
  U   CMF/branches/jens_tools_as_utilities/CMFDefault/skins/zpt_generic/get_permalink.py
  U   CMF/branches/jens_tools_as_utilities/CMFDefault/skins/zpt_generic/join_form.py
  U   CMF/branches/jens_tools_as_utilities/CMFDefault/skins/zpt_generic/logged_in.py
  U   CMF/branches/jens_tools_as_utilities/CMFDefault/skins/zpt_generic/password_email.py
  U   CMF/branches/jens_tools_as_utilities/CMFDefault/skins/zpt_generic/password_form.py
  U   CMF/branches/jens_tools_as_utilities/CMFDefault/skins/zpt_generic/recent_news.py
  U   CMF/branches/jens_tools_as_utilities/CMFDefault/skins/zpt_generic/registered_email.py
  U   CMF/branches/jens_tools_as_utilities/CMFDefault/skins/zpt_generic/search.py
  U   CMF/branches/jens_tools_as_utilities/CMFDefault/skins/zpt_generic/search_form.py
  U   CMF/branches/jens_tools_as_utilities/CMFDefault/skins/zpt_generic/setup_talkback_tree.py
  U   CMF/branches/jens_tools_as_utilities/CMFDefault/skins/zpt_generic/synPropertiesForm.py
  U   CMF/branches/jens_tools_as_utilities/CMFDefault/tests/RegistrationTool.txt
  U   CMF/branches/jens_tools_as_utilities/CMFDefault/tests/test_Favorite.py
  U   CMF/branches/jens_tools_as_utilities/CMFDefault/tests/test_Portal.py
  U   CMF/branches/jens_tools_as_utilities/CMFTopic/Topic.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-27 21:00:43 UTC (rev 71656)
+++ CMF/branches/jens_tools_as_utilities/CMFCalendar/browser/event.txt	2006-12-27 22:35:30 UTC (rev 71657)
@@ -15,10 +15,12 @@
     >>> from Products.CMFCore.interfaces import IPropertiesTool
     >>> from Products.CMFCore.interfaces import ISkinsTool
     >>> from Products.CMFCore.interfaces import ITypesTool
+    >>> from Products.CMFCore.interfaces import IURLTool
     >>> sm = getSiteManager()
     >>> sm.registerUtility(app.site.portal_properties, IPropertiesTool)
     >>> sm.registerUtility(app.site.portal_skins, ISkinsTool)
     >>> sm.registerUtility(app.site.portal_types, ITypesTool)
+    >>> sm.registerUtility(app.site.portal_url, IURLTool)
 
 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-27 21:00:43 UTC (rev 71656)
+++ CMF/branches/jens_tools_as_utilities/CMFCalendar/tests/test_Calendar.py	2006-12-27 22:35:30 UTC (rev 71657)
@@ -33,6 +33,7 @@
 from Products.CMFCore.interfaces import IPropertiesTool
 from Products.CMFCore.interfaces import ISkinsTool
 from Products.CMFCore.interfaces import ITypesTool
+from Products.CMFCore.interfaces import IURLTool
 from Products.CMFCalendar.testing import FunctionalLayer
 
 
@@ -129,6 +130,7 @@
         sm.registerUtility(self.app.site.portal_properties, IPropertiesTool)
         sm.registerUtility(self.app.site.portal_skins, ISkinsTool)
         sm.registerUtility(self.app.site.portal_types, ITypesTool)
+        sm.registerUtility(self.app.site.portal_url, IURLTool)
 
     def _testURL(self, url, params=None):
         obj = self.app.site.restrictedTraverse(url)

Modified: CMF/branches/jens_tools_as_utilities/CMFCore/DynamicType.py
===================================================================
--- CMF/branches/jens_tools_as_utilities/CMFCore/DynamicType.py	2006-12-27 21:00:43 UTC (rev 71656)
+++ CMF/branches/jens_tools_as_utilities/CMFCore/DynamicType.py	2006-12-27 22:35:30 UTC (rev 71657)
@@ -20,13 +20,14 @@
 from AccessControl import ClassSecurityInfo
 from Globals import InitializeClass
 
+from zope.component import getUtility
 from zope.component import queryUtility
 from zope.interface import implements
 
 from interfaces import IDynamicType
 from interfaces import ITypesTool
+from interfaces import IURLTool
 from interfaces.Dynamic import DynamicType as z2IDynamicType
-from utils import getToolByName
 
 
 class DynamicType:
@@ -103,7 +104,7 @@
                     return icon
                 else:
                     # Relative to REQUEST['BASEPATH1']
-                    portal_url = getToolByName( self, 'portal_url' )
+                    portal_url = getUtility(IURLTool)
                     res = portal_url(relative=1) + '/' + icon
                     while res[:1] == '/':
                         res = res[1:]

Modified: CMF/branches/jens_tools_as_utilities/CMFCore/Expression.py
===================================================================
--- CMF/branches/jens_tools_as_utilities/CMFCore/Expression.py	2006-12-27 21:00:43 UTC (rev 71656)
+++ CMF/branches/jens_tools_as_utilities/CMFCore/Expression.py	2006-12-27 22:35:30 UTC (rev 71657)
@@ -26,7 +26,7 @@
 from Products.PageTemplates.Expressions import SecureModuleImporter
 
 from interfaces import IMembershipTool
-from utils import getToolByName
+from interfaces import IURLTool
 
 
 class Expression(Persistent):
@@ -67,7 +67,7 @@
     else:
         ec = None
     if ec is None:
-        utool = getToolByName(context, 'portal_url')
+        utool = getUtility(IURLTool).__of__(context)
         portal = utool.getPortalObject()
         if object is None or not hasattr(object, 'aq_base'):
             folder = portal

Modified: CMF/branches/jens_tools_as_utilities/CMFCore/MembershipTool.py
===================================================================
--- CMF/branches/jens_tools_as_utilities/CMFCore/MembershipTool.py	2006-12-27 21:00:43 UTC (rev 71656)
+++ CMF/branches/jens_tools_as_utilities/CMFCore/MembershipTool.py	2006-12-27 22:35:30 UTC (rev 71657)
@@ -38,6 +38,7 @@
 from interfaces import IMemberDataTool
 from interfaces import IMembershipTool
 from interfaces import IRegistrationTool
+from interfaces import IURLTool
 from interfaces.portal_membership \
         import portal_membership as z2IMembershipTool
 from permissions import AccessContentsInformation
@@ -50,7 +51,6 @@
 from utils import _checkPermission
 from utils import _dtmldir
 from utils import _getAuthenticatedUser
-from utils import getToolByName
 from utils import UniqueObject
 
 
@@ -513,7 +513,7 @@
 
         # Delete members' local roles.
         if delete_localroles:
-            utool = getToolByName(self, 'portal_url', None)
+            utool = getUtility(IURLTool)
             self.deleteLocalRoles( utool.getPortalObject(), member_ids,
                                    reindex=1, recursive=1 )
 

Modified: CMF/branches/jens_tools_as_utilities/CMFCore/SkinsTool.py
===================================================================
--- CMF/branches/jens_tools_as_utilities/CMFCore/SkinsTool.py	2006-12-27 21:00:43 UTC (rev 71656)
+++ CMF/branches/jens_tools_as_utilities/CMFCore/SkinsTool.py	2006-12-27 22:35:30 UTC (rev 71657)
@@ -37,13 +37,13 @@
 from DirectoryView import ignore_re
 from interfaces import IMembershipTool
 from interfaces import ISkinsTool
+from interfaces import IURLTool
 from interfaces.portal_skins import portal_skins as z2ISkinsTool
 from permissions import AccessContentsInformation
 from permissions import ManagePortal
 from permissions import View
 from SkinsContainer import SkinsContainer
 from utils import _dtmldir
-from utils import getToolByName
 from utils import registerToolInterface
 from utils import UniqueObject
 
@@ -310,7 +310,7 @@
         """ If needed, updates the skin cookie based on the member preference.
         """
         mtool = getUtility(IMembershipTool)
-        utool = getToolByName(self, 'portal_url')
+        utool = getUtility(IURLTool)
         member = mtool.getAuthenticatedMember()
         if hasattr(aq_base(member), 'portal_skin'):
             mskin = member.portal_skin
@@ -345,7 +345,7 @@
         """
         req = self.REQUEST
         resp = req.RESPONSE
-        utool = getToolByName(self, 'portal_url')
+        utool = getUtility(IURLTool)
         portal_path = req['BASEPATH1'] + '/' + utool(1)
         resp.expireCookie(self.request_varname, path=portal_path)
 

Modified: CMF/branches/jens_tools_as_utilities/CMFCore/URLTool.py
===================================================================
--- CMF/branches/jens_tools_as_utilities/CMFCore/URLTool.py	2006-12-27 21:00:43 UTC (rev 71656)
+++ CMF/branches/jens_tools_as_utilities/CMFCore/URLTool.py	2006-12-27 22:35:30 UTC (rev 71657)
@@ -29,6 +29,7 @@
 from permissions import ManagePortal
 from permissions import View
 from utils import _dtmldir
+from utils import registerToolInterface
 from utils import UniqueObject
 
 
@@ -99,3 +100,5 @@
         return '/'.join( self.getPortalObject().getPhysicalPath() )
 
 InitializeClass(URLTool)
+registerToolInterface('portal_url', IURLTool)
+

Modified: CMF/branches/jens_tools_as_utilities/CMFCore/interfaces/_tools.py
===================================================================
--- CMF/branches/jens_tools_as_utilities/CMFCore/interfaces/_tools.py	2006-12-27 21:00:43 UTC (rev 71656)
+++ CMF/branches/jens_tools_as_utilities/CMFCore/interfaces/_tools.py	2006-12-27 22:35:30 UTC (rev 71657)
@@ -1243,7 +1243,103 @@
         o Permission:  Public
         """
 
+#
+# Syndication tool interface
+#
+class ISyndicationTool(Interface):
 
+    """ An object that provides content syndication facilities
+    """
+
+    id = Attribute('id',
+            """ The ID of the tool.
+
+            o BBB:  for use in 'getToolByName';  in the future, prefer
+              'zapi.getUtility(ISyndicationTool)'.
+
+            o Must be set to "portal_syndication"
+            """,
+            )
+
+    def enableSyndication(obj):
+        """ Enable syndication for the passed-in object
+
+        o raises 'Syndication is Disabled' if syndication is now allowed
+
+        o raises 'Syndication Information Exists' if used repeatedly
+        """
+
+    def disableSyndication(obj):
+        """ Disable syndication for the passed-in object
+
+        o raises 'This object does not have Syndication Information' if 
+          syndication has already been disabled
+        """
+
+    def getSyndicatableContent(obj):
+        """ Retrieve all syndicatable content from the passed-in object
+
+        o will call the hool "synContentValues" if it exists to allow
+          individual customization
+
+        o falls back to calling contentValues
+        """
+
+    def isSiteSyndicationAllowed():
+        """ Return the site-wide syndication flag
+        """
+
+    def isSyndicationAllowed(obj=None):
+        """ Return the syndication flag for the passed-in object
+
+        o falls back to retrieving the site-wide syndication flag
+        """
+
+    def getUpdatePeriod(obj=None):
+        """ Return the update period for the syndicated feed
+
+        o falls back to the site-wide value if no object is passed in
+
+        o raises 'Syndication is not Allowed' if the site-wide policy
+          does not allow syndication
+        """
+
+    def getUpdateFrequency(obj=None):
+        """ Return the syndicated feed update frequency
+
+        o falls back to the site-wide value if no object is passed in
+
+        o raises 'Syndication is not Allowed' if the site-wide policy
+          does not allow syndication
+        """
+
+    def getUpdateBase(obj=None):
+        """ Return the syndication feed base date for the publishing schedule
+
+        o falls back to the site-wide value if no object is passed in
+
+        o raises 'Syndication is not Allowed' if the site-wide policy
+          does not allow syndication
+        """
+
+    def getHTML4UpdateBase(obj=None):
+        """ return the HTML-formatted feed publishing base date
+
+        o falls back to the site-wide value if no object is passed in
+
+        o raises 'Syndication is not Allowed' if the site-wide policy
+          does not allow syndication
+        """
+        
+    def getMaxItems(obj=None):
+        """ Return the number of items published at any one time in the feed
+
+        o falls back to the site-wide value if no object is passed in
+
+        o raises 'Syndication is not Allowed' if the site-wide policy
+          does not allow syndication
+        """
+
 #
 #   Types tool interfaces
 #

Modified: CMF/branches/jens_tools_as_utilities/CMFCore/tests/test_ActionProviderBase.py
===================================================================
--- CMF/branches/jens_tools_as_utilities/CMFCore/tests/test_ActionProviderBase.py	2006-12-27 21:00:43 UTC (rev 71656)
+++ CMF/branches/jens_tools_as_utilities/CMFCore/tests/test_ActionProviderBase.py	2006-12-27 22:35:30 UTC (rev 71657)
@@ -21,6 +21,7 @@
 from zope.component import getSiteManager
 
 from Products.CMFCore.interfaces import IMembershipTool
+from Products.CMFCore.interfaces import IURLTool
 from Products.CMFCore.tests.base.dummy import DummySite
 from Products.CMFCore.tests.base.dummy import DummyTool
 from Products.CMFCore.tests.base.testcase import SecurityRequestTest
@@ -67,6 +68,7 @@
         self.site = DummySite('site').__of__(self.root)
         sm = getSiteManager()
         utool = self.site._setObject( 'portal_url', DummyTool() )
+        sm.registerUtility(self.site.portal_url, IURLTool)
         mtool = self.site._setObject( 'portal_membership', DummyTool() )
         sm.registerUtility(self.site.portal_membership, IMembershipTool)
 

Modified: CMF/branches/jens_tools_as_utilities/CMFCore/tests/test_ActionsTool.py
===================================================================
--- CMF/branches/jens_tools_as_utilities/CMFCore/tests/test_ActionsTool.py	2006-12-27 21:00:43 UTC (rev 71656)
+++ CMF/branches/jens_tools_as_utilities/CMFCore/tests/test_ActionsTool.py	2006-12-27 22:35:30 UTC (rev 71657)
@@ -25,6 +25,7 @@
 from Products.CMFCore.ActionInformation import ActionInformation
 from Products.CMFCore.Expression import Expression
 from Products.CMFCore.MembershipTool import MembershipTool
+from Products.CMFCore.interfaces import IURLTool
 from Products.CMFCore.tests.base.testcase import SecurityRequestTest
 from Products.CMFCore.URLTool import URLTool
 from Products.CMFCore.interfaces import IMembershipTool
@@ -113,6 +114,7 @@
         sm = getSiteManager()
         root._setObject( 'portal_actions', self._makeOne() )
         root._setObject( 'portal_url', URLTool() )
+        sm.registerUtility(root.portal_url, IURLTool)
         root._setObject( 'foo', URLTool() )
         root._setObject('portal_membership', MembershipTool())
         sm.registerUtility(root.portal_membership, IMembershipTool)

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-27 21:00:43 UTC (rev 71656)
+++ CMF/branches/jens_tools_as_utilities/CMFCore/tests/test_DynamicType.py	2006-12-27 22:35:30 UTC (rev 71657)
@@ -27,6 +27,7 @@
 from Products.CMFCore.DynamicType import DynamicType
 from Products.CMFCore.interfaces import IMembershipTool
 from Products.CMFCore.interfaces import ITypesTool
+from Products.CMFCore.interfaces import IURLTool
 from Products.CMFCore.tests.base.dummy import DummyObject
 from Products.CMFCore.tests.base.dummy import DummySite
 from Products.CMFCore.tests.base.dummy import DummyTool
@@ -96,6 +97,7 @@
         self.site._setObject( 'portal_types', TypesTool() )
         sm.registerUtility(self.site.portal_types, ITypesTool)
         self.site._setObject( 'portal_url', DummyTool() )
+        sm.registerUtility(self.site.portal_url, IURLTool)
         fti = FTIDATA_CMF15[0].copy()
         self.site.portal_types._setObject( 'Dummy Content 15', FTI(**fti) )
         self.site._setObject( 'foo', DummyContent() )

Modified: CMF/branches/jens_tools_as_utilities/CMFCore/tests/test_MembershipTool.py
===================================================================
--- CMF/branches/jens_tools_as_utilities/CMFCore/tests/test_MembershipTool.py	2006-12-27 21:00:43 UTC (rev 71656)
+++ CMF/branches/jens_tools_as_utilities/CMFCore/tests/test_MembershipTool.py	2006-12-27 22:35:30 UTC (rev 71657)
@@ -26,6 +26,7 @@
 from Products.CMFCore.MemberDataTool import MemberDataTool
 from Products.CMFCore.PortalFolder import PortalFolder
 from Products.CMFCore.interfaces import IMemberDataTool
+from Products.CMFCore.interfaces import IURLTool
 from Products.CMFCore.tests.base.dummy import DummySite
 from Products.CMFCore.tests.base.dummy import DummyTool
 from Products.CMFCore.tests.base.dummy import DummyUserFolder
@@ -119,6 +120,7 @@
         members = site._setObject( 'Members', PortalFolder('Members') )
         acl_users = site._setObject( 'acl_users', DummyUserFolder() )
         utool = site._setObject( 'portal_url', DummyTool() )
+        sm.registerUtility(utool, IURLTool)
         wtool = site._setObject( 'portal_workflow', DummyTool() )
         mdtool = site._setObject( 'portal_memberdata', MemberDataTool() )
         sm.registerUtility(mdtool, IMemberDataTool)

Modified: CMF/branches/jens_tools_as_utilities/CMFDefault/Favorite.py
===================================================================
--- CMF/branches/jens_tools_as_utilities/CMFDefault/Favorite.py	2006-12-27 21:00:43 UTC (rev 71656)
+++ CMF/branches/jens_tools_as_utilities/CMFDefault/Favorite.py	2006-12-27 22:35:30 UTC (rev 71657)
@@ -22,9 +22,11 @@
 from Acquisition import aq_base
 from zope.app.container.interfaces import IObjectAddedEvent
 from zope.component import adapter
+from zope.component import getUtility
 from zope.component.factory import Factory
 from zope.interface import implements
 
+from Products.CMFCore.interfaces import IURLTool
 from Products.CMFCore.utils import getToolByName
 
 from DublinCore import DefaultDublinCoreImpl
@@ -72,7 +74,7 @@
         if handler is None or not hasattr(handler, 'register'):
             return
         
-        portal = getToolByName(self, 'portal_url').getPortalObject()
+        portal = getUtility(IURLTool).getPortalObject()
         obj = portal.restrictedTraverse(self.remote_url)
         return handler.register(obj)
 
@@ -112,7 +114,7 @@
     def _getRemoteUrlTheOldWay(self):
         """Build the url without having taking the uid into account
         """
-        portal_url = getToolByName(self, 'portal_url')
+        portal_url = getUtility(IURLTool)
         if self.remote_url:
             return portal_url() + '/' + self.remote_url
         else:
@@ -139,7 +141,7 @@
         if remote_obj is not None:
             return remote_obj
 
-        portal_url = getToolByName(self, 'portal_url')
+        portal_url = getUtility(IURLTool)
         return portal_url.getPortalObject().restrictedTraverse(self.remote_url)
 
     security.declarePrivate('_edit')
@@ -155,7 +157,7 @@
             t=('', '') + tokens[2:]
             remote_url=urlparse.urlunparse(t)
         # if URL begins with site URL, remove site URL
-        portal_url = getToolByName(self, 'portal_url').getPortalPath()
+        portal_url = getUtility(IURLTool).getPortalPath()
         i = remote_url.find(portal_url)
         if i==0:
             remote_url=remote_url[len(portal_url):]

Modified: CMF/branches/jens_tools_as_utilities/CMFDefault/SyndicationTool.py
===================================================================
--- CMF/branches/jens_tools_as_utilities/CMFDefault/SyndicationTool.py	2006-12-27 21:00:43 UTC (rev 71656)
+++ CMF/branches/jens_tools_as_utilities/CMFDefault/SyndicationTool.py	2006-12-27 22:35:30 UTC (rev 71657)
@@ -24,9 +24,13 @@
 from Globals import InitializeClass
 from OFS.SimpleItem import SimpleItem
 
+from zope.interface import implements
+
 from Products.CMFCore.ActionProviderBase import ActionProviderBase
+from Products.CMFCore.interfaces import ISyndicationTool
 from Products.CMFCore.PortalFolder import PortalFolderBase
 from Products.CMFCore.utils import _checkPermission
+from Products.CMFCore.utils import registerToolInterface
 from Products.CMFCore.utils import UniqueObject
 
 from exceptions import AccessControl_Unauthorized
@@ -43,6 +47,7 @@
         syndication of folder content as RSS.
     """
 
+    implements(ISyndicationTool)
     __implements__ = ActionProviderBase.__implements__
 
     id = 'portal_syndication'
@@ -348,7 +353,7 @@
             return 'Syndication is not Allowed'
 
     security.declarePublic('getHTML4UpdateBase')
-    def getHTML4UpdateBase(self, obj):
+    def getHTML4UpdateBase(self, obj=None):
         """
         Return HTML4 formated UpdateBase DateTime
         """
@@ -385,3 +390,5 @@
             return 'Syndication is not Allowed'
 
 InitializeClass(SyndicationTool)
+registerToolInterface('portal_syndication', ISyndicationTool)
+

Modified: CMF/branches/jens_tools_as_utilities/CMFDefault/browser/favorite.py
===================================================================
--- CMF/branches/jens_tools_as_utilities/CMFDefault/browser/favorite.py	2006-12-27 21:00:43 UTC (rev 71656)
+++ CMF/branches/jens_tools_as_utilities/CMFDefault/browser/favorite.py	2006-12-27 22:35:30 UTC (rev 71657)
@@ -19,13 +19,14 @@
 
 from zope.app.form.browser import BytesWidget
 from zope.component import adapts
+from zope.component import getUtility
 from zope.formlib import form
 from zope.interface import implements
 from zope.interface import Interface
 from zope.schema import BytesLine
 from zope.schema import TextLine
 
-from Products.CMFCore.utils import getToolByName
+from Products.CMFCore.interfaces import IURLTool
 from Products.CMFDefault.formlib.form import ContentEditFormBase
 from Products.CMFDefault.formlib.schema import ProxyFieldProperty
 from Products.CMFDefault.formlib.schema import SchemaAdapterBase
@@ -82,7 +83,7 @@
             value = urlparse.urlunparse(tokens)
         # if URL begins with site URL, remove site URL
         obj = self.context.context.context
-        portal_url = getToolByName(obj, 'portal_url').getPortalPath()
+        portal_url = getUtility(IURLTool)
         if value.startswith(portal_url):
             value = value[len(portal_url):]
         # if site is still absolute, make it relative

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-27 21:00:43 UTC (rev 71656)
+++ CMF/branches/jens_tools_as_utilities/CMFDefault/profiles/default/componentregistry.xml	2006-12-27 22:35:30 UTC (rev 71657)
@@ -39,7 +39,13 @@
      interface="Products.CMFCore.interfaces.ISkinsTool"
      object="/portal_skins"/>
   <utility
+     interface="Products.CMFCore.interfaces.ISyndicationTool"
+     object="/portal_syndication"/>
+  <utility
      interface="Products.CMFCore.interfaces.ITypesTool"
      object="/portal_types"/>
+  <utility
+     interface="Products.CMFCore.interfaces.IURLTool"
+     object="/portal_url"/>
  </utilities>
 </componentregistry>

Modified: CMF/branches/jens_tools_as_utilities/CMFDefault/skins/zpt_control/setRedirect.py
===================================================================
--- CMF/branches/jens_tools_as_utilities/CMFDefault/skins/zpt_control/setRedirect.py	2006-12-27 21:00:43 UTC (rev 71656)
+++ CMF/branches/jens_tools_as_utilities/CMFDefault/skins/zpt_control/setRedirect.py	2006-12-27 22:35:30 UTC (rev 71657)
@@ -1,10 +1,12 @@
 ##parameters=provider, action_path, **kw
 ##
 from ZTUtils import make_query
-from Products.CMFCore.utils import getToolByName
+from Products.CMFCore.utils import getToolByInterfaceName
 from Products.CMFDefault.utils import getBrowserCharset
 
-utool = getToolByName(script, 'portal_url')
+utool = getToolByInterfaceName( script
+                              , 'Products.CMFCore.interfaces.IURLTool'
+                              )
 portal_url = utool()
 
 

Modified: CMF/branches/jens_tools_as_utilities/CMFDefault/skins/zpt_generic/RSS.py
===================================================================
--- CMF/branches/jens_tools_as_utilities/CMFDefault/skins/zpt_generic/RSS.py	2006-12-27 21:00:43 UTC (rev 71656)
+++ CMF/branches/jens_tools_as_utilities/CMFDefault/skins/zpt_generic/RSS.py	2006-12-27 22:35:30 UTC (rev 71657)
@@ -2,10 +2,12 @@
 ##
 from ZTUtils import Batch
 from ZTUtils import LazyFilter
-from Products.CMFCore.utils import getToolByName
+from Products.CMFCore.utils import getToolByInterfaceName
 from Products.CMFDefault.utils import decode
 
-stool = getToolByName(script, 'portal_syndication')
+stool = getToolByInterfaceName( script
+                              , 'Products.CMFCore.interfaces.ISyndicationTool'
+                              )
 
 
 if not stool.isSyndicationAllowed(context):

Modified: CMF/branches/jens_tools_as_utilities/CMFDefault/skins/zpt_generic/breadcrumbs.py
===================================================================
--- CMF/branches/jens_tools_as_utilities/CMFDefault/skins/zpt_generic/breadcrumbs.py	2006-12-27 21:00:43 UTC (rev 71656)
+++ CMF/branches/jens_tools_as_utilities/CMFDefault/skins/zpt_generic/breadcrumbs.py	2006-12-27 22:35:30 UTC (rev 71657)
@@ -2,13 +2,14 @@
 ##title=Return breadcrumbs
 ##
 from Products.CMFCore.utils import getToolByInterfaceName
-from Products.CMFCore.utils import getToolByName
 from Products.CMFDefault.utils import Message as _
 
 ptool = getToolByInterfaceName( script
                               , 'Products.CMFCore.interfaces.IPropertiesTool'
                               )
-utool = getToolByName(script, 'portal_url')
+utool = getToolByInterfaceName( script
+                              , 'Products.CMFCore.interfaces.IURLTool'
+                              )
 portal_url = utool()
 result = []
 

Modified: CMF/branches/jens_tools_as_utilities/CMFDefault/skins/zpt_generic/expanded_title.py
===================================================================
--- CMF/branches/jens_tools_as_utilities/CMFDefault/skins/zpt_generic/expanded_title.py	2006-12-27 21:00:43 UTC (rev 71656)
+++ CMF/branches/jens_tools_as_utilities/CMFDefault/skins/zpt_generic/expanded_title.py	2006-12-27 22:35:30 UTC (rev 71657)
@@ -2,10 +2,12 @@
 ##parameters=
 ##title=Build title which includes site title
 ##
-from Products.CMFCore.utils import getToolByName
+from Products.CMFCore.utils import getToolByInterfaceName
 from Products.CMFDefault.utils import decode
 
-utool = getToolByName(script, 'portal_url')
+utool = getToolByInterfaceName( script
+                              , 'Products.CMFCore.interfaces.IURLTool'
+                              )
 
 site_title = utool.getPortalObject().Title()
 page_title = context.Title()

Modified: CMF/branches/jens_tools_as_utilities/CMFDefault/skins/zpt_generic/folder_contents.py
===================================================================
--- CMF/branches/jens_tools_as_utilities/CMFDefault/skins/zpt_generic/folder_contents.py	2006-12-27 21:00:43 UTC (rev 71656)
+++ CMF/branches/jens_tools_as_utilities/CMFDefault/skins/zpt_generic/folder_contents.py	2006-12-27 22:35:30 UTC (rev 71657)
@@ -2,7 +2,7 @@
 ##
 from ZTUtils import Batch
 from ZTUtils import make_query
-from Products.CMFCore.utils import getToolByName
+from Products.CMFCore.utils import getToolByInterfaceName
 from Products.CMFDefault.permissions import AddPortalContent
 from Products.CMFDefault.permissions import DeleteObjects
 from Products.CMFDefault.permissions import ListFolderContents
@@ -12,8 +12,12 @@
 from Products.CMFDefault.utils import html_marshal
 from Products.CMFDefault.utils import Message as _
 
-mtool = getToolByName(script, 'portal_membership')
-utool = getToolByName(script, 'portal_url')
+mtool = getToolByInterfaceName( script
+                              , 'Products.CMFCore.interfaces.IMembershipTool'
+                              )
+utool = getToolByInterfaceName( script
+                              , 'Products.CMFCore.interfaces.IURLTool'
+                              )
 portal_url = utool()
 
 

Modified: CMF/branches/jens_tools_as_utilities/CMFDefault/skins/zpt_generic/folder_rename_form.py
===================================================================
--- CMF/branches/jens_tools_as_utilities/CMFDefault/skins/zpt_generic/folder_rename_form.py	2006-12-27 21:00:43 UTC (rev 71656)
+++ CMF/branches/jens_tools_as_utilities/CMFDefault/skins/zpt_generic/folder_rename_form.py	2006-12-27 22:35:30 UTC (rev 71657)
@@ -1,11 +1,13 @@
 ##parameters=b_start=0, key='', reverse=0, ids=(), new_ids=(), rename='', cancel=''
 ##
-from Products.CMFCore.utils import getToolByName
+from Products.CMFCore.utils import getToolByInterfaceName
 from Products.CMFDefault.utils import decode
 from Products.CMFDefault.utils import html_marshal
 from Products.CMFDefault.utils import Message as _
 
-utool = getToolByName(script, 'portal_url')
+utool = getToolByInterfaceName( script
+                              , 'Products.CMFCore.interfaces.IURLTool'
+                              )
 portal_url = utool()
 
 

Modified: CMF/branches/jens_tools_as_utilities/CMFDefault/skins/zpt_generic/getBatchItemInfos.py
===================================================================
--- CMF/branches/jens_tools_as_utilities/CMFDefault/skins/zpt_generic/getBatchItemInfos.py	2006-12-27 21:00:43 UTC (rev 71656)
+++ CMF/branches/jens_tools_as_utilities/CMFDefault/skins/zpt_generic/getBatchItemInfos.py	2006-12-27 22:35:30 UTC (rev 71657)
@@ -2,9 +2,11 @@
 ##parameters=batch_obj
 ##title=
 ##
-from Products.CMFCore.utils import getToolByName
+from Products.CMFCore.utils import getToolByInterfaceName
 
-utool = getToolByName(script, 'portal_url')
+utool = getToolByInterfaceName( script
+                              , 'Products.CMFCore.interfaces.IURLTool'
+                              )
 portal_url = utool()
 
 items = []

Modified: CMF/branches/jens_tools_as_utilities/CMFDefault/skins/zpt_generic/getMainGlobals.py
===================================================================
--- CMF/branches/jens_tools_as_utilities/CMFDefault/skins/zpt_generic/getMainGlobals.py	2006-12-27 21:00:43 UTC (rev 71656)
+++ CMF/branches/jens_tools_as_utilities/CMFDefault/skins/zpt_generic/getMainGlobals.py	2006-12-27 22:35:30 UTC (rev 71657)
@@ -15,7 +15,9 @@
 ptool = getToolByInterfaceName( script
                               , 'Products.CMFCore.interfaces.IPropertiesTool'
                               )
-utool = getToolByName(script, 'portal_url')
+utool = getToolByInterfaceName( script
+                              , 'Products.CMFCore.interfaces.IURLTool'
+                              )
 wtool = getToolByName(script, 'portal_workflow')
 portal_object = utool.getPortalObject()
 

Modified: CMF/branches/jens_tools_as_utilities/CMFDefault/skins/zpt_generic/get_permalink.py
===================================================================
--- CMF/branches/jens_tools_as_utilities/CMFDefault/skins/zpt_generic/get_permalink.py	2006-12-27 21:00:43 UTC (rev 71656)
+++ CMF/branches/jens_tools_as_utilities/CMFDefault/skins/zpt_generic/get_permalink.py	2006-12-27 22:35:30 UTC (rev 71657)
@@ -22,7 +22,9 @@
     
     if showPermalink and not isFolderish:
         # returns the uid (generates one if necessary)
-        urltool = getToolByName(context, 'portal_url')
+        utool = getToolByInterfaceName( script
+                                      , 'Products.CMFCore.interfaces.IURLTool'
+                                      )
         uid = uidtool.register(context)
-        url = "%s/permalink/%s" % (urltool(), uid)
+        url = "%s/permalink/%s" % (utool(), uid)
         return url

Modified: CMF/branches/jens_tools_as_utilities/CMFDefault/skins/zpt_generic/join_form.py
===================================================================
--- CMF/branches/jens_tools_as_utilities/CMFDefault/skins/zpt_generic/join_form.py	2006-12-27 21:00:43 UTC (rev 71656)
+++ CMF/branches/jens_tools_as_utilities/CMFDefault/skins/zpt_generic/join_form.py	2006-12-27 22:35:30 UTC (rev 71657)
@@ -1,7 +1,6 @@
 ##parameters=b_start=0, member_id='', member_email='', password='', confirm='', send_password='', add='', cancel=''
 ##
 from Products.CMFCore.utils import getToolByInterfaceName
-from Products.CMFCore.utils import getToolByName
 from Products.CMFDefault.permissions import ManageUsers
 from Products.CMFDefault.utils import decode
 from Products.CMFDefault.utils import Message as _
@@ -15,7 +14,9 @@
 ptool = getToolByInterfaceName( script
                               , 'Products.CMFCore.interfaces.IPropertiesTool'
                               )
-utool = getToolByName(script, 'portal_url')
+utool = getToolByInterfaceName( script
+                              , 'Products.CMFCore.interfaces.IURLTool'
+                              )
 portal_url = utool()
 validate_email = ptool.getProperty('validate_email')
 is_anon = mtool.isAnonymousUser()

Modified: CMF/branches/jens_tools_as_utilities/CMFDefault/skins/zpt_generic/logged_in.py
===================================================================
--- CMF/branches/jens_tools_as_utilities/CMFDefault/skins/zpt_generic/logged_in.py	2006-12-27 21:00:43 UTC (rev 71656)
+++ CMF/branches/jens_tools_as_utilities/CMFDefault/skins/zpt_generic/logged_in.py	2006-12-27 22:35:30 UTC (rev 71657)
@@ -1,7 +1,6 @@
 ##parameters=
 ##
 from Products.CMFCore.utils import getToolByInterfaceName
-from Products.CMFCore.utils import getToolByName
 from Products.CMFDefault.utils import decode
 from Products.CMFDefault.utils import Message as _
 
@@ -14,7 +13,9 @@
 stool = getToolByInterfaceName( script
                               , 'Products.CMFCore.interfaces.ISkinsTool'
                               )
-utool = getToolByName(script, 'portal_url')
+utool = getToolByInterfaceName( script
+                              , 'Products.CMFCore.interfaces.IURLTool'
+                              )
 portal_url = utool()
 
 

Modified: CMF/branches/jens_tools_as_utilities/CMFDefault/skins/zpt_generic/password_email.py
===================================================================
--- CMF/branches/jens_tools_as_utilities/CMFDefault/skins/zpt_generic/password_email.py	2006-12-27 21:00:43 UTC (rev 71656)
+++ CMF/branches/jens_tools_as_utilities/CMFDefault/skins/zpt_generic/password_email.py	2006-12-27 22:35:30 UTC (rev 71657)
@@ -1,7 +1,6 @@
 ##parameters=member=None, password='secret'
 ##
 from Products.CMFCore.utils import getToolByInterfaceName
-from Products.CMFCore.utils import getToolByName
 from Products.CMFDefault.utils import decode
 from Products.CMFDefault.utils import makeEmail
 from Products.CMFDefault.utils import Message as _
@@ -12,7 +11,9 @@
 ptool = getToolByInterfaceName( script
                               , 'Products.CMFCore.interfaces.IPropertiesTool'
                               )
-utool = getToolByName(script, 'portal_url')
+utool = getToolByInterfaceName( script
+                              , 'Products.CMFCore.interfaces.IURLTool'
+                              )
 portal_url = utool()
 
 

Modified: CMF/branches/jens_tools_as_utilities/CMFDefault/skins/zpt_generic/password_form.py
===================================================================
--- CMF/branches/jens_tools_as_utilities/CMFDefault/skins/zpt_generic/password_form.py	2006-12-27 21:00:43 UTC (rev 71656)
+++ CMF/branches/jens_tools_as_utilities/CMFDefault/skins/zpt_generic/password_form.py	2006-12-27 22:35:30 UTC (rev 71657)
@@ -1,7 +1,6 @@
 ##parameters=change='', cancel=''
 ##
 from Products.CMFCore.utils import getToolByInterfaceName
-from Products.CMFCore.utils import getToolByName
 from Products.CMFDefault.utils import decode
 from Products.CMFDefault.utils import Message as _
 
@@ -14,7 +13,9 @@
 ptool = getToolByInterfaceName( script
                               , 'Products.CMFCore.interfaces.IPropertiesTool'
                               )
-utool = getToolByName(script, 'portal_url')
+utool = getToolByInterfaceName( script
+                              , 'Products.CMFCore.interfaces.IURLTool'
+                              )
 member = mtool.getAuthenticatedMember()
 portal_url = utool()
 

Modified: CMF/branches/jens_tools_as_utilities/CMFDefault/skins/zpt_generic/recent_news.py
===================================================================
--- CMF/branches/jens_tools_as_utilities/CMFDefault/skins/zpt_generic/recent_news.py	2006-12-27 21:00:43 UTC (rev 71656)
+++ CMF/branches/jens_tools_as_utilities/CMFDefault/skins/zpt_generic/recent_news.py	2006-12-27 22:35:30 UTC (rev 71657)
@@ -2,11 +2,15 @@
 ##
 from Products.PythonScripts.standard import structured_text
 from ZTUtils import Batch
-from Products.CMFCore.utils import getToolByName
+from Products.CMFCore.utils import getToolByInterfaceName
 from Products.CMFDefault.utils import decode
 
-ctool = getToolByName(script, 'portal_catalog')
-utool = getToolByName(script, 'portal_url')
+ctool = getToolByInterfaceName( script
+                              , 'Products.CMFCore.interfaces.ICatalogTool'
+                              )
+utool = getToolByInterfaceName( script
+                              , 'Products.CMFCore.interfaces.IURLTool'
+                              )
 portal_url = utool()
 
 

Modified: CMF/branches/jens_tools_as_utilities/CMFDefault/skins/zpt_generic/registered_email.py
===================================================================
--- CMF/branches/jens_tools_as_utilities/CMFDefault/skins/zpt_generic/registered_email.py	2006-12-27 21:00:43 UTC (rev 71656)
+++ CMF/branches/jens_tools_as_utilities/CMFDefault/skins/zpt_generic/registered_email.py	2006-12-27 22:35:30 UTC (rev 71657)
@@ -1,7 +1,6 @@
 ##parameters=member=None, password='secret', email='foo at example.org'
 ##
 from Products.CMFCore.utils import getToolByInterfaceName
-from Products.CMFCore.utils import getToolByName
 from Products.CMFDefault.utils import decode
 from Products.CMFDefault.utils import makeEmail
 from Products.CMFDefault.utils import Message as _
@@ -12,7 +11,9 @@
 ptool = getToolByInterfaceName( script
                               , 'Products.CMFCore.interfaces.IPropertiesTool'
                               )
-utool = getToolByName(script, 'portal_url')
+utool = getToolByInterfaceName( script
+                              , 'Products.CMFCore.interfaces.IURLTool'
+                              )
 portal_url = utool()
 
 

Modified: CMF/branches/jens_tools_as_utilities/CMFDefault/skins/zpt_generic/search.py
===================================================================
--- CMF/branches/jens_tools_as_utilities/CMFDefault/skins/zpt_generic/search.py	2006-12-27 21:00:43 UTC (rev 71656)
+++ CMF/branches/jens_tools_as_utilities/CMFDefault/skins/zpt_generic/search.py	2006-12-27 22:35:30 UTC (rev 71657)
@@ -2,12 +2,16 @@
 ##
 from Products.PythonScripts.standard import thousands_commas
 from ZTUtils import Batch
-from Products.CMFCore.utils import getToolByName
+from Products.CMFCore.utils import getToolByInterfaceName
 from Products.CMFDefault.utils import decode
 from Products.CMFDefault.utils import Message as _
 
-ctool = getToolByName(script, 'portal_catalog')
-utool = getToolByName(script, 'portal_url')
+ctool = getToolByInterfaceName( script
+                              , 'Products.CMFCore.interfaces.ICatalogTool'
+                              )
+utool = getToolByInterfaceName( script
+                              , 'Products.CMFCore.interfaces.IURLTool'
+                              )
 portal_url = utool()
 epoch = DateTime('1970/01/01 00:00:01 GMT')
 

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-27 21:00:43 UTC (rev 71656)
+++ CMF/branches/jens_tools_as_utilities/CMFDefault/skins/zpt_generic/search_form.py	2006-12-27 22:35:30 UTC (rev 71657)
@@ -1,7 +1,6 @@
 ##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 _
@@ -15,7 +14,9 @@
 ttool = getToolByInterfaceName( script
                               , 'Products.CMFCore.interfaces.ITypesTool'
                               )
-utool = getToolByName(script, 'portal_url')
+utool = getToolByInterfaceName( script
+                              , 'Products.CMFCore.interfaces.IURLTool'
+                              )
 portal_url = utool()
 
 

Modified: CMF/branches/jens_tools_as_utilities/CMFDefault/skins/zpt_generic/setup_talkback_tree.py
===================================================================
--- CMF/branches/jens_tools_as_utilities/CMFDefault/skins/zpt_generic/setup_talkback_tree.py	2006-12-27 21:00:43 UTC (rev 71656)
+++ CMF/branches/jens_tools_as_utilities/CMFDefault/skins/zpt_generic/setup_talkback_tree.py	2006-12-27 22:35:30 UTC (rev 71657)
@@ -2,12 +2,16 @@
 ##title=Standard Tree
 ##
 from ZTUtils import SimpleTreeMaker
-from Products.CMFCore.utils import getToolByName
+from Products.CMFCore.utils import getToolByInterfaceName
 from Products.CMFDefault.permissions import ManagePortal
 from Products.CMFDefault.utils import decode
 
-mtool = getToolByName(script, 'portal_membership')
-utool = getToolByName(script, 'portal_url')
+mtool = getToolByInterfaceName( script
+                              , 'Products.CMFCore.interfaces.IMembershipTool'
+                              )
+utool = getToolByInterfaceName( script
+                              , 'Products.CMFCore.interfaces.IURLTool'
+                              )
 portal_url = utool()
 
 tm = SimpleTreeMaker('tb_tree')

Modified: CMF/branches/jens_tools_as_utilities/CMFDefault/skins/zpt_generic/synPropertiesForm.py
===================================================================
--- CMF/branches/jens_tools_as_utilities/CMFDefault/skins/zpt_generic/synPropertiesForm.py	2006-12-27 21:00:43 UTC (rev 71656)
+++ CMF/branches/jens_tools_as_utilities/CMFDefault/skins/zpt_generic/synPropertiesForm.py	2006-12-27 22:35:30 UTC (rev 71657)
@@ -1,9 +1,11 @@
 ##parameters=
 ##
-from Products.CMFCore.utils import getToolByName
+from Products.CMFCore.utils import getToolByInterfaceName
 from Products.CMFDefault.utils import decode
 
-stool = getToolByName(script, 'portal_syndication')
+stool = getToolByInterfaceName( script
+                              , 'Products.CMFCore.interfaces.ISyndicationTool'
+                              )
 
 
 options = {}

Modified: CMF/branches/jens_tools_as_utilities/CMFDefault/tests/RegistrationTool.txt
===================================================================
--- CMF/branches/jens_tools_as_utilities/CMFDefault/tests/RegistrationTool.txt	2006-12-27 21:00:43 UTC (rev 71656)
+++ CMF/branches/jens_tools_as_utilities/CMFDefault/tests/RegistrationTool.txt	2006-12-27 22:35:30 UTC (rev 71657)
@@ -90,12 +90,14 @@
     >>> from Testing.makerequest import makerequest
     >>> from Products.CMFCore.interfaces import IActionsTool
     >>> from Products.CMFCore.interfaces import IPropertiesTool
+    >>> from Products.CMFCore.interfaces import IURLTool
     >>> s = makerequest(DummySite())
     >>> s.REQUEST.environ['HTTP_X_FORWARDED_FOR'] = 'NNN.NNN.NNN.NNN'
     >>> s.portal_actions = s.portal_properties = s.portal_url = DummyTool()
     >>> sm = getSiteManager()
     >>> sm.registerUtility(s.portal_actions, IActionsTool)
     >>> sm.registerUtility(s.portal_properties, IPropertiesTool)
+    >>> sm.registerUtility(s.portal_url, IURLTool)
     >>> s.ZopeTime = 'NNNN/NN/NN'
     >>> s.description = 'THE SITE DESCRIPTION.'
     >>> s.default_charset = 'utf-8'

Modified: CMF/branches/jens_tools_as_utilities/CMFDefault/tests/test_Favorite.py
===================================================================
--- CMF/branches/jens_tools_as_utilities/CMFDefault/tests/test_Favorite.py	2006-12-27 21:00:43 UTC (rev 71656)
+++ CMF/branches/jens_tools_as_utilities/CMFDefault/tests/test_Favorite.py	2006-12-27 22:35:30 UTC (rev 71657)
@@ -18,6 +18,10 @@
 import unittest
 import Testing
 
+from zope.component import getSiteManager
+
+from Products.CMFCore.interfaces import IMembershipTool
+from Products.CMFCore.interfaces import IURLTool
 from Products.CMFCore.testing import ConformsToContent
 from Products.CMFCore.tests.base.dummy import DummySite
 from Products.CMFCore.tests.base.dummy import DummyTool
@@ -34,9 +38,12 @@
         return self._getTargetClass()(*args, **kw)
 
     def setUp(self):
+        sm = getSiteManager()
         self.site = DummySite('site')
         self.site._setObject( 'portal_membership', DummyTool() )
+        sm.registerUtility(self.site.portal_membership, IMembershipTool)
         self.site._setObject( 'portal_url', DummyTool() )
+        sm.registerUtility(self.site.portal_url, IURLTool)
 
     def test_z3interfaces(self):
         from zope.interface.verify import verifyClass

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-27 21:00:43 UTC (rev 71656)
+++ CMF/branches/jens_tools_as_utilities/CMFDefault/tests/test_Portal.py	2006-12-27 22:35:30 UTC (rev 71657)
@@ -27,6 +27,7 @@
 from Products.CMFCore.interfaces import ICatalogTool
 from Products.CMFCore.interfaces import IMembershipTool
 from Products.CMFCore.interfaces import ITypesTool
+from Products.CMFCore.interfaces import IURLTool
 from Products.CMFDefault.testing import FunctionalLayer
 
 
@@ -41,6 +42,7 @@
         sm.registerUtility(self.app.site.portal_catalog, ICatalogTool)
         sm.registerUtility(self.app.site.portal_membership, IMembershipTool)
         sm.registerUtility(self.app.site.portal_types, ITypesTool)
+        sm.registerUtility(self.app.site.portal_url, IURLTool)
 
     def _makeContent( self, site, portal_type, id='document', **kw ):
         newSecurityManager(None, UnrestrictedUser('god', '', ['Manager'], ''))

Modified: CMF/branches/jens_tools_as_utilities/CMFTopic/Topic.py
===================================================================
--- CMF/branches/jens_tools_as_utilities/CMFTopic/Topic.py	2006-12-27 21:00:43 UTC (rev 71656)
+++ CMF/branches/jens_tools_as_utilities/CMFTopic/Topic.py	2006-12-27 22:35:30 UTC (rev 71657)
@@ -25,7 +25,7 @@
 
 from Products.CMFDefault.SkinnedFolder import SkinnedFolder
 from Products.CMFCore.interfaces import ICatalogTool
-from Products.CMFCore.utils import getToolByName
+from Products.CMFCore.interfaces import ISyndicationTool
 
 from interfaces import IMutableTopic
 from interfaces import ITopic
@@ -153,7 +153,7 @@
         o Return no more brain objects than the limit set by the
           syndication tool.
         """
-        syn_tool = getToolByName( self, 'portal_syndication' )
+        syn_tool = getUtility(ISyndicationTool)
         limit = syn_tool.getMaxItems( self )
         brains = self.queryCatalog( sort_limit=limit )[ :limit ]
         return [ brain.getObject() for brain in brains ]

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-27 21:00:43 UTC (rev 71656)
+++ CMF/branches/jens_tools_as_utilities/CMFTopic/tests/test_DateC.py	2006-12-27 22:35:30 UTC (rev 71657)
@@ -24,6 +24,7 @@
 
 from Products.CMFCore.interfaces import ICatalogTool
 from Products.CMFCore.interfaces import ITypesTool
+from Products.CMFCore.interfaces import IURLTool
 from Products.CMFCore.tests.base.dummy import DummyContent
 from Products.CMFDefault.testing import FunctionalLayer
 from Products.CMFTopic.Topic import Topic
@@ -168,6 +169,7 @@
         sm = getSiteManager()
         sm.registerUtility(self.site.portal_catalog, ICatalogTool)
         sm.registerUtility(self.site.portal_types, ITypesTool)
+        sm.registerUtility(self.site.portal_url, IURLTool)
         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-27 21:00:43 UTC (rev 71656)
+++ CMF/branches/jens_tools_as_utilities/CMFTopic/tests/test_Topic.py	2006-12-27 22:35:30 UTC (rev 71657)
@@ -24,6 +24,7 @@
 from zope.component import getSiteManager
 
 from Products.CMFCore.interfaces import ICatalogTool
+from Products.CMFCore.interfaces import ISyndicationTool
 from Products.CMFCore.interfaces import ITypesTool
 from Products.CMFCore.testing import ConformsToFolder
 from Products.CMFCore.testing import EventZCMLLayer
@@ -146,6 +147,7 @@
         self.site.portal_catalog = DummyCatalog( index_ids )
         sm.registerUtility(self.site.portal_catalog, ICatalogTool)
         self.site.portal_syndication = DummySyndicationTool( max_items )
+        sm.registerUtility(self.site.portal_syndication, ISyndicationTool)
 
     def _initDocuments(self, **kw):
         for k, v in kw.items():



More information about the CMF-checkins mailing list