[Zope3-checkins] SVN: Zope3/branches/jim-adapter/src/zope/app/ Some
provideUtility -> registerUtility conversion to cut down the
Philipp von Weitershausen
philikon at philikon.de
Tue Apr 4 14:52:51 EDT 2006
Log message for revision 66433:
Some provideUtility -> registerUtility conversion to cut down the
deprecation noise a bit.
Changed:
U Zope3/branches/jim-adapter/src/zope/app/component/metaconfigure.py
U Zope3/branches/jim-adapter/src/zope/app/mail/metaconfigure.py
U Zope3/branches/jim-adapter/src/zope/app/publisher/browser/tests/test_addMenuItem.py
U Zope3/branches/jim-adapter/src/zope/app/pythonpage/tests.py
U Zope3/branches/jim-adapter/src/zope/app/rdb/metaconfigure.py
U Zope3/branches/jim-adapter/src/zope/app/schema/tests/test_interfaceutility.py
-=-
Modified: Zope3/branches/jim-adapter/src/zope/app/component/metaconfigure.py
===================================================================
--- Zope3/branches/jim-adapter/src/zope/app/component/metaconfigure.py 2006-04-04 18:45:35 UTC (rev 66432)
+++ Zope3/branches/jim-adapter/src/zope/app/component/metaconfigure.py 2006-04-04 18:52:49 UTC (rev 66433)
@@ -258,8 +258,7 @@
_context.action(
discriminator = ('utility', provides, name),
callable = handler,
- args = ('provideUtility',
- provides, component, name),
+ args = ('registerUtility', component, provides, name),
)
_context.action(
discriminator = None,
Modified: Zope3/branches/jim-adapter/src/zope/app/mail/metaconfigure.py
===================================================================
--- Zope3/branches/jim-adapter/src/zope/app/mail/metaconfigure.py 2006-04-04 18:45:35 UTC (rev 66432)
+++ Zope3/branches/jim-adapter/src/zope/app/mail/metaconfigure.py 2006-04-04 18:52:49 UTC (rev 66433)
@@ -44,7 +44,7 @@
delivery = QueuedMailDelivery(queuePath)
delivery = _assertPermission(permission, IMailDelivery, delivery)
- handler('provideUtility', IMailDelivery, delivery, name)
+ handler('registerUtility', delivery, IMailDelivery, name)
mailerObject = zapi.queryUtility(IMailer, mailer)
if mailerObject is None:
@@ -71,7 +71,7 @@
delivery = DirectMailDelivery(mailerObject)
delivery = _assertPermission(permission, IMailDelivery, delivery)
- handler('provideUtility', IMailDelivery, delivery, name)
+ handler('registerUtility', delivery, IMailDelivery, name)
_context.action(
discriminator = ('utility', IMailDelivery, name),
@@ -84,6 +84,6 @@
_context.action(
discriminator = ('utility', IMailer, name),
callable = handler,
- args = ('provideUtility',
- IMailer, SMTPMailer(hostname, port, username, password), name)
+ args = ('registerUtility',
+ SMTPMailer(hostname, port, username, password), IMailer, name)
)
Modified: Zope3/branches/jim-adapter/src/zope/app/publisher/browser/tests/test_addMenuItem.py
===================================================================
--- Zope3/branches/jim-adapter/src/zope/app/publisher/browser/tests/test_addMenuItem.py 2006-04-04 18:45:35 UTC (rev 66432)
+++ Zope3/branches/jim-adapter/src/zope/app/publisher/browser/tests/test_addMenuItem.py 2006-04-04 18:52:49 UTC (rev 66433)
@@ -21,9 +21,9 @@
<InterfaceClass zope.component.interfaces.IFactory>,
'BrowserAdd__zope.app.publisher.browser.tests.test_addMenuItem.X'),
<function handler>,
- ('provideUtility',
+ ('registerUtility',
+ <Factory for <class 'zope.app.publisher.browser.tests.test_addMenuItem.X'>>,
<InterfaceClass zope.component.interfaces.IFactory>,
- <Factory for <class 'zope.app.publisher.browser.tests.test_addMenuItem.X'>>,
'BrowserAdd__zope.app.publisher.browser.tests.test_addMenuItem.X')),
(None,
<function provideInterface>,
@@ -182,9 +182,9 @@
<InterfaceClass zope.component.interfaces.IFactory>,
'BrowserAdd__zope.app.publisher.browser.tests.test_addMenuItem.X'),
<function handler>,
- ('provideUtility',
+ ('registerUtility',
+ <Factory for <class 'zope.app.publisher.browser.tests.test_addMenuItem.X'>>,
<InterfaceClass zope.component.interfaces.IFactory>,
- <Factory for <class 'zope.app.publisher.browser.tests.test_addMenuItem.X'>>,
'BrowserAdd__zope.app.publisher.browser.tests.test_addMenuItem.X')),
(None,
<function provideInterface>,
Modified: Zope3/branches/jim-adapter/src/zope/app/pythonpage/tests.py
===================================================================
--- Zope3/branches/jim-adapter/src/zope/app/pythonpage/tests.py 2006-04-04 18:45:35 UTC (rev 66432)
+++ Zope3/branches/jim-adapter/src/zope/app/pythonpage/tests.py 2006-04-04 18:52:49 UTC (rev 66433)
@@ -38,7 +38,7 @@
def setUp(test):
placelesssetup.setUp()
sm = zapi.getGlobalSiteManager()
- sm.provideUtility(IInterpreter, PythonInterpreter, 'text/server-python')
+ sm.registerUtility(PythonInterpreter, IInterpreter, 'text/server-python')
ztapi.provideAdapter(None, IPhysicallyLocatable,
LocationPhysicallyLocatable)
Modified: Zope3/branches/jim-adapter/src/zope/app/rdb/metaconfigure.py
===================================================================
--- Zope3/branches/jim-adapter/src/zope/app/rdb/metaconfigure.py 2006-04-04 18:45:35 UTC (rev 66432)
+++ Zope3/branches/jim-adapter/src/zope/app/rdb/metaconfigure.py 2006-04-04 18:52:49 UTC (rev 66433)
@@ -32,7 +32,7 @@
Uses the global site manager for registering the connection
"""
gsm = zapi.getGlobalSiteManager()
- gsm.provideUtility(IZopeDatabaseAdapter, connection, name)
+ gsm.registerUtility(connection, IZopeDatabaseAdapter, name)
Modified: Zope3/branches/jim-adapter/src/zope/app/schema/tests/test_interfaceutility.py
===================================================================
--- Zope3/branches/jim-adapter/src/zope/app/schema/tests/test_interfaceutility.py 2006-04-04 18:45:35 UTC (rev 66432)
+++ Zope3/branches/jim-adapter/src/zope/app/schema/tests/test_interfaceutility.py 2006-04-04 18:52:49 UTC (rev 66433)
@@ -89,9 +89,9 @@
def test_getLocalInterface_delegates_to_globalUtility(self):
gsm = zapi.getGlobalSiteManager()
- gsm.provideUtility(IInterface, Bar("blob"), name="blob")
- gsm.provideUtility(IBaz, Baz("global baz"))
- gsm.provideUtility(IInterface, Foo("global bob"), name="bob")
+ gsm.registerUtility(Bar("blob"), IInterface, name="blob")
+ gsm.registerUtility(Baz("global baz"), IBaz)
+ gsm.registerUtility(Foo("global bob"), IInterface, name="bob")
self.assertEqual(getInterface(None, "bob").__class__, Foo)
self.assertEqual(getInterface(None, "blob").__class__, Bar)
@@ -102,9 +102,9 @@
foo = Foo("global bob")
gsm = zapi.getGlobalSiteManager()
- gsm.provideUtility(IInterface, foo, name="bob")
- gsm.provideUtility(IInterface, bar)
- gsm.provideUtility(IBaz, baz)
+ gsm.registerUtility(foo, IInterface, name="bob")
+ gsm.registerUtility(bar, IInterface)
+ gsm.registerUtility(baz, IBaz)
ifaces = searchInterface(None)
self.assert_(len(ifaces), 2)
@@ -126,10 +126,11 @@
baz = Baz("global baz")
foo = Foo("global bob")
gsm = zapi.getGlobalSiteManager()
- gsm.provideUtility(IInterface, foo, name="bob")
- gsm.provideUtility(ILocalUtility, bar)
- gsm.provideUtility(IBaz, baz)
+ gsm.registerUtility(foo, IInterface, name="bob")
+ gsm.registerUtility(bar, ILocalUtility)
+ gsm.registerUtility(baz, IBaz)
+
iface_utilities = gsm.getUtilitiesFor(IInterface)
ifaces = [iface for (name, iface) in iface_utilities]
self.assertEqual(ifaces, [(foo)])
@@ -144,9 +145,9 @@
def test_getLocalInterface_raisesComponentLookupError(self):
gsm = zapi.getGlobalSiteManager()
- gsm.provideUtility(IInterface, Foo("global"))
- gsm.provideUtility(IBaz, Baz("global baz"))
- gsm.provideUtility(IInterface, Foo("global bob"), name="bob")
+ gsm.registerUtility(Foo("global"), Interface)
+ gsm.registerUtility(Baz("global baz"), IBaz)
+ gsm.registerUtility(Foo("global bob"), IInterface, name="bob")
self.assertRaises(ComponentLookupError,
getInterface, None, "bobesponja")
@@ -156,9 +157,9 @@
bar = Bar("global")
baz = Baz("global baz")
gsm = zapi.getGlobalSiteManager()
- gsm.provideUtility(IInterface, bar)
- gsm.provideUtility(IBaz, baz)
- gsm.provideUtility(IInterface, foo, name="bob")
+ gsm.registerUtility(foo, IInterface, name="bob")
+ gsm.registerUtility(bar, IInterface)
+ gsm.registerUtility(baz, IBaz)
self.assertEqual(searchInterface(None, search_string="bob"),
[foo])
@@ -169,9 +170,9 @@
bar = Bar("global")
baz = Baz("global baz")
gsm = zapi.getGlobalSiteManager()
- gsm.provideUtility(IInterface, bar)
- gsm.provideUtility(IBaz, baz)
- gsm.provideUtility(IInterface, foo, name="bob")
+ gsm.registerUtility(foo, IInterface, name="bob")
+ gsm.registerUtility(bar, IInterface)
+ gsm.registerUtility(baz, IBaz)
self.assertEqual(searchInterface(None, search_string="bob"),
[foo])
@@ -192,8 +193,8 @@
def test_local_utilities(self):
gsm = zapi.getGlobalSiteManager()
- gsm.provideUtility(IInterface, Foo("global"))
- gsm.provideUtility(IInterface, Foo("global bob"), name="bob")
+ gsm.registerUtility(Foo("global"), IInterface)
+ gsm.registerUtility(Foo("global bob"), IInterface, name="bob")
sm = zapi.getSiteManager(self.rootFolder)
default = traverse(self.rootFolder, "++etc++site/default")
More information about the Zope3-Checkins
mailing list