[CMF-checkins] SVN: CMF/trunk/CMFCore/ - use ISiteRoot utility
Yvo Schubbe
y.2007- at wcm-solutions.de
Thu Mar 8 18:48:26 EST 2007
Log message for revision 73085:
- use ISiteRoot utility
Changed:
U CMF/trunk/CMFCore/Expression.py
U CMF/trunk/CMFCore/tests/test_ActionProviderBase.py
U CMF/trunk/CMFCore/tests/test_DynamicType.py
-=-
Modified: CMF/trunk/CMFCore/Expression.py
===================================================================
--- CMF/trunk/CMFCore/Expression.py 2007-03-08 23:47:18 UTC (rev 73084)
+++ CMF/trunk/CMFCore/Expression.py 2007-03-08 23:48:26 UTC (rev 73085)
@@ -19,14 +19,13 @@
from Acquisition import aq_base, aq_inner, aq_parent
from Globals import InitializeClass
from Globals import Persistent
-
from zope.component import getUtility
from Products.PageTemplates.Expressions import getEngine
from Products.PageTemplates.Expressions import SecureModuleImporter
from interfaces import IMembershipTool
-from interfaces import IURLTool
+from interfaces import ISiteRoot
class Expression(Persistent):
@@ -67,8 +66,7 @@
else:
ec = None
if ec is None:
- utool = getUtility(IURLTool)
- portal = utool.getPortalObject()
+ portal = getUtility(ISiteRoot)
if object is None or not hasattr(object, 'aq_base'):
folder = portal
else:
Modified: CMF/trunk/CMFCore/tests/test_ActionProviderBase.py
===================================================================
--- CMF/trunk/CMFCore/tests/test_ActionProviderBase.py 2007-03-08 23:47:18 UTC (rev 73084)
+++ CMF/trunk/CMFCore/tests/test_ActionProviderBase.py 2007-03-08 23:48:26 UTC (rev 73085)
@@ -22,7 +22,7 @@
from zope.testing.cleanup import cleanUp
from Products.CMFCore.interfaces import IMembershipTool
-from Products.CMFCore.interfaces import IURLTool
+from Products.CMFCore.interfaces import ISiteRoot
from Products.CMFCore.tests.base.dummy import DummySite
from Products.CMFCore.tests.base.dummy import DummyTool
from Products.CMFCore.tests.base.testcase import SecurityRequestTest
@@ -68,8 +68,7 @@
SecurityRequestTest.setUp(self)
self.site = DummySite('site').__of__(self.root)
sm = getSiteManager()
- utool = self.site._setObject( 'portal_url', DummyTool() )
- sm.registerUtility(self.site.portal_url, IURLTool)
+ sm.registerUtility(self.site, ISiteRoot)
sm.registerUtility(DummyTool(), IMembershipTool)
def tearDown(self):
Modified: CMF/trunk/CMFCore/tests/test_DynamicType.py
===================================================================
--- CMF/trunk/CMFCore/tests/test_DynamicType.py 2007-03-08 23:47:18 UTC (rev 73084)
+++ CMF/trunk/CMFCore/tests/test_DynamicType.py 2007-03-08 23:48:26 UTC (rev 73085)
@@ -35,7 +35,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.interfaces import ISiteRoot
from Products.CMFCore.tests.base.dummy import DummyObject
from Products.CMFCore.tests.base.dummy import DummySite
from Products.CMFCore.tests.base.dummy import DummyTool
@@ -163,12 +163,11 @@
SecurityRequestTest.setUp(self)
self.site = DummySite('site').__of__(self.root)
sm = getSiteManager()
+ sm.registerUtility(self.site, ISiteRoot)
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() )
- 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() )
More information about the CMF-checkins
mailing list