[Checkins] SVN: Zope3/trunk/src/zope/app/intid/ Changed getUtility to queryUtility with a reasonable default as

Albertas Agejevas alga at pov.lt
Thu Feb 1 13:09:10 EST 2007


Log message for revision 72304:
  Changed getUtility to queryUtility with a reasonable default as
  Bernd Dorn suggested.
  

Changed:
  U   Zope3/trunk/src/zope/app/intid/__init__.py
  U   Zope3/trunk/src/zope/app/intid/tests.py

-=-
Modified: Zope3/trunk/src/zope/app/intid/__init__.py
===================================================================
--- Zope3/trunk/src/zope/app/intid/__init__.py	2007-02-01 18:02:22 UTC (rev 72303)
+++ Zope3/trunk/src/zope/app/intid/__init__.py	2007-02-01 18:09:08 UTC (rev 72304)
@@ -29,7 +29,7 @@
 from zope.interface import implements
 from zope.security.proxy import removeSecurityProxy
 from zope.location.interfaces import ILocation
-from zope.component import adapter, getAllUtilitiesRegisteredFor, getUtility
+from zope.component import adapter, getAllUtilitiesRegisteredFor, queryUtility
 from zope.component.interfaces import IFactory
 
 from zope.component.factory import Factory
@@ -56,8 +56,8 @@
     _randrange = random.randrange
 
     def __init__(self):
-        self.ids = getUtility(IFactory, 'OIBTree')()
-        self.refs = getUtility(IFactory, 'IOBTree')()
+        self.ids = queryUtility(IFactory, 'OIBTree', OIBTree.OIBTree)()
+        self.refs = queryUtility(IFactory, 'IOBTree', IOBTree.IOBTree)()
 
     def __len__(self):
         return len(self.ids)

Modified: Zope3/trunk/src/zope/app/intid/tests.py
===================================================================
--- Zope3/trunk/src/zope/app/intid/tests.py	2007-02-01 18:02:22 UTC (rev 72303)
+++ Zope3/trunk/src/zope/app/intid/tests.py	2007-02-01 18:09:08 UTC (rev 72304)
@@ -63,8 +63,6 @@
         ztapi.provideAdapter(IPersistent, IConnection, connectionOfPersistent)
         ztapi.provideAdapter(IPersistent, IKeyReference,
                              KeyReferenceToPersistent)
-        ztapi.provideUtility(IFactory, IOBTreeFactory, 'IOBTree')
-        ztapi.provideUtility(IFactory, OIBTreeFactory, 'OIBTree')
 
     def tearDown(self):
         setup.placefulTearDown()



More information about the Checkins mailing list