[Zope3-checkins] SVN: Zope3/trunk/src/ Updated the code to reflect the changes to the Component Architecture

Albertas Agejevas alga at pov.lt
Fri May 21 21:56:27 EDT 2004


Log message for revision 24869:

Updated the code to reflect the changes to the Component Architecture
API: the context is now the last argument and is optional.

getServiceManager() is now called getServices() or getGlobalServices().




-=-
Modified: Zope3/trunk/src/buddydemo/buddy.py
===================================================================
--- Zope3/trunk/src/buddydemo/buddy.py	2004-05-22 01:54:58 UTC (rev 24868)
+++ Zope3/trunk/src/buddydemo/buddy.py	2004-05-22 01:56:25 UTC (rev 24869)
@@ -94,7 +94,7 @@
     __used_for__ = IBuddy
 
     def __init__(self, buddy):
-        lookup = zapi.getUtility(buddy, IPostalLookup)
+        lookup = zapi.getUtility(IPostalLookup)
         info = lookup.lookup(buddy.postal_code)
         if info is None:
             self.city, self.state = '', ''

Modified: Zope3/trunk/src/zope/app/adapter/adapter.py
===================================================================
--- Zope3/trunk/src/zope/app/adapter/adapter.py	2004-05-22 01:54:58 UTC (rev 24868)
+++ Zope3/trunk/src/zope/app/adapter/adapter.py	2004-05-22 01:56:25 UTC (rev 24869)
@@ -24,7 +24,7 @@
 from zope.interface.adapter import adapterImplied, Default
 from zope.interface.adapter import Surrogate, AdapterRegistry
 import sys
-import zope.app.component.nextservice
+import zope.app.component.localservice
 import zope.app.container.contained
 import zope.app.registration.interfaces
 import zope.app.site.interfaces
@@ -214,8 +214,9 @@
         )
 
     def __updateNext(self, servicename):
-        next = zope.app.component.nextservice.getNextService(self, servicename)
-        global_ = zapi.getService(None, servicename)
+        next = zope.app.component.localservice.getNextService(
+            self, servicename)
+        global_ = zapi.getGlobalServices().getService(servicename)
         if next == global_:
             next = None
         self.setNext(next, global_)
@@ -226,11 +227,11 @@
         # Now, we need to notify any sub-site services. This is
         # a bit complicated because our immediate subsites might not have
         # the same service. Sigh
-        sm = zapi.getServiceManager(self)
+        sm = zapi.getServices(self)
         self.__notifySubs(sm.subSites, servicename)
 
     def unbound(self, servicename):
-        sm = zapi.getServiceManager(self)
+        sm = zapi.getServices(self)
         self.__notifySubs(sm.subSites, servicename)
 
     def __notifySubs(self, subs, servicename):

Modified: Zope3/trunk/src/zope/app/adapter/tests.py
===================================================================
--- Zope3/trunk/src/zope/app/adapter/tests.py	2004-05-22 01:54:58 UTC (rev 24868)
+++ Zope3/trunk/src/zope/app/adapter/tests.py	2004-05-22 01:56:25 UTC (rev 24869)
@@ -630,7 +630,7 @@
 
     Define the service
 
-    >>> gsm = zapi.getServiceManager(None)
+    >>> gsm = zapi.getGlobalServices()
     >>> gsm.defineService('F', IF1)
 
     Create the global service

Modified: Zope3/trunk/src/zope/app/apidoc/__init__.py
===================================================================
--- Zope3/trunk/src/zope/app/apidoc/__init__.py	2004-05-22 01:54:58 UTC (rev 24868)
+++ Zope3/trunk/src/zope/app/apidoc/__init__.py	2004-05-22 01:56:25 UTC (rev 24869)
@@ -53,7 +53,8 @@
     
     def get(self, key, default=None):
         """See zope.app.container.interfaces.IReadContainer"""
-        utility = zapi.queryUtility(self, IDocumentationModule, default, key)
+        utility = zapi.queryUtility(IDocumentationModule, default, key,
+                                    context=self)
         if utility != default:
             locate(utility, self, key)
         return utility

Modified: Zope3/trunk/src/zope/app/apidoc/browser/ftests.py
===================================================================
--- Zope3/trunk/src/zope/app/apidoc/browser/ftests.py	2004-05-22 01:54:58 UTC (rev 24868)
+++ Zope3/trunk/src/zope/app/apidoc/browser/ftests.py	2004-05-22 01:56:25 UTC (rev 24869)
@@ -22,7 +22,7 @@
     """Just a couple of tests ensuring that the templates render."""
 
     def testMenu(self):
-        response = self.publish('/++apidoc++/menu.html', 
+        response = self.publish('/++apidoc++/menu.html',
                                 basic='mgr:mgrpw')
         self.assertEqual(response.getStatus(), 200)
         body = response.getBody()
@@ -32,7 +32,7 @@
 
 
     def testIndexView(self):
-        response = self.publish('/++apidoc++/index.html', 
+        response = self.publish('/++apidoc++/index.html',
                                 basic='mgr:mgrpw')
         self.assertEqual(response.getStatus(), 200)
         body = response.getBody()
@@ -41,7 +41,7 @@
                                  basic='mgr:mgrpw')
 
     def testContentsView(self):
-        response = self.publish('/++apidoc++/contents.html', 
+        response = self.publish('/++apidoc++/contents.html',
                                 basic='mgr:mgrpw')
         self.assertEqual(response.getStatus(), 200)
         body = response.getBody()
@@ -58,8 +58,8 @@
             '<a href="contents.html" target="main">Zope 3 API Docs</a>') > 0)
         self.checkForBrokenLinks(body, '/++apidoc++/modulelist.html',
                                  basic='mgr:mgrpw')
-        
 
+
 def test_suite():
     return unittest.TestSuite((
         unittest.makeSuite(APIDocTests),

Modified: Zope3/trunk/src/zope/app/apidoc/classmodule/browser.py
===================================================================
--- Zope3/trunk/src/zope/app/apidoc/classmodule/browser.py	2004-05-22 01:54:58 UTC (rev 24868)
+++ Zope3/trunk/src/zope/app/apidoc/classmodule/browser.py	2004-05-22 01:56:25 UTC (rev 24869)
@@ -44,7 +44,7 @@
 
           >>> from zope.app.apidoc.tests import pprint
           >>> from zope.app.apidoc.classmodule import Class
-          >>> cm = zapi.getUtility(None, IDocumentationModule, 'Class')
+          >>> cm = zapi.getUtility(IDocumentationModule, 'Class')
           >>> mod = cm['zope']['app']['apidoc']['classmodule']['browser']
 
           Setup a couple of classes and register them.
@@ -94,7 +94,7 @@
         path = self.request.get('path', None)
         if path is None:
             return []
-        classModule = zapi.getUtility(None, IDocumentationModule, "Class")
+        classModule = zapi.getUtility(IDocumentationModule, "Class")
         results = []
         for p in classRegistry.keys():
             if p.find(path) >= 0:
@@ -168,7 +168,7 @@
             'url': 'http://127.0.0.1/zope/app/apidoc/classmodule/Module'}]
         """
         info = []
-        classModule = zapi.getUtility(None, IDocumentationModule, "Class")
+        classModule = zapi.getUtility(IDocumentationModule, "Class")
         for base in self.context.getBases():
             path = getPythonPath(base)
             klass = zapi.traverse(classModule, path.replace('.', '/'))
@@ -189,11 +189,11 @@
 
           Note that the following output is a bit different than usual, since
           we have not setup all path elements.
-          
+
           >>> view.getBaseURL()
           'http://127.0.0.1'
         """
-        m = zapi.getUtility(None, IDocumentationModule, "Class")
+        m = zapi.getUtility(IDocumentationModule, "Class")
         return zapi.getView(zapi.getParent(m), 'absolute_url', self.request)()
 
 

Modified: Zope3/trunk/src/zope/app/apidoc/ifacemodule/browser.py
===================================================================
--- Zope3/trunk/src/zope/app/apidoc/ifacemodule/browser.py	2004-05-22 01:54:58 UTC (rev 24868)
+++ Zope3/trunk/src/zope/app/apidoc/ifacemodule/browser.py	2004-05-22 01:56:25 UTC (rev 24869)
@@ -342,7 +342,7 @@
              'zope.app.traversing.interfaces.IPhysicallyLocatable'),
             ('required', [])]]
         """
-        service = zapi.getService(self.context, 'Adapters')
+        service = zapi.getService('Adapters')
         iface = removeAllProxies(self.context)
         adapters = []
         for reg in service.registrations():
@@ -382,7 +382,7 @@
             ('name', ''),
             ('required', ['zope.app.apidoc.ifacemodule.tests.IBar'])]]
         """
-        service = zapi.getService(self.context, 'Adapters')
+        service = zapi.getService('Adapters')
         iface = removeAllProxies(self.context)
         adapters = []
         for reg in service.registrations():
@@ -443,7 +443,7 @@
         """
         iface = removeAllProxies(self.context)
         factories = [(n, f) for n, f in
-                    zapi.getFactoriesFor(self.context, iface)
+                    zapi.getFactoriesFor(iface)
                     if iface in tuple(f.getInterfaces())]
         info = []
         for name, factory in factories:
@@ -473,7 +473,7 @@
             ('url', 'zope/app/apidoc/ifacemodule/tests/Foo'),
             ('url_name', u'The Foo')]]
         """
-        service = zapi.getService(self.context, 'Utilities')
+        service = zapi.getService('Utilities')
         utils = service.getUtilitiesFor(removeAllProxies(self.context))
         info = []
         for name, util in utils:
@@ -499,6 +499,6 @@
           ['Foo']
         """
         iface = removeAllProxies(self.context)
-        service = zapi.getService(self.context, 'Services')
+        service = zapi.getService('Services')
         services = service.getServiceDefinitions()
         return [ser[0] for ser in services if ser[1] is iface]

Modified: Zope3/trunk/src/zope/app/apidoc/servicemodule/__init__.py
===================================================================
--- Zope3/trunk/src/zope/app/apidoc/servicemodule/__init__.py	2004-05-22 01:54:58 UTC (rev 24868)
+++ Zope3/trunk/src/zope/app/apidoc/servicemodule/__init__.py	2004-05-22 01:56:25 UTC (rev 24869)
@@ -92,7 +92,7 @@
 
     def get(self, key, default=None):
         """See zope.app.container.interfaces.IReadContainer"""
-        service = zapi.getService(self, Services)
+        service = zapi.getService(Services)
         items = service.getServiceDefinitions()
 
         for name, iface in items:
@@ -107,7 +107,7 @@
 
     def items(self):
         """See zope.app.container.interfaces.IReadContainer"""
-        service = zapi.getService(self, Services)
+        service = zapi.getService(Services)
         items = service.getServiceDefinitions()
         items.sort()
         return [(name, self.get(name)) for name, iface in items]

Modified: Zope3/trunk/src/zope/app/apidoc/utilitymodule/__init__.py
===================================================================
--- Zope3/trunk/src/zope/app/apidoc/utilitymodule/__init__.py	2004-05-22 01:54:58 UTC (rev 24868)
+++ Zope3/trunk/src/zope/app/apidoc/utilitymodule/__init__.py	2004-05-22 01:56:25 UTC (rev 24869)
@@ -18,7 +18,7 @@
 from zope.interface import implements
 
 from zope.app import zapi
-from zope.app.component.nextservice import queryNextService
+from zope.app.component.localservice import queryNextService
 from zope.app.location.interfaces import ILocation
 from zope.app.servicenames import Utilities
 from zope.app.apidoc.interfaces import IDocumentationModule
@@ -80,7 +80,7 @@
 
     def get(self, key, default=None):
         """See zope.app.container.interfaces.IReadContainer"""
-        service = zapi.getService(self, Utilities)        
+        service = zapi.getService(Utilities)
         if key == NONAME:
             key = ''
         utils = [Utility(self, reg)
@@ -91,7 +91,7 @@
 
     def items(self):
         """See zope.app.container.interfaces.IReadContainer"""
-        service = zapi.getService(self, Utilities)
+        service = zapi.getService(Utilities)
         items = []
 
         while service is not None:
@@ -152,7 +152,7 @@
             return UtilityInterface(self, key, getattr(mod, parts[-1], default))
 
     def items(self):
-        service = zapi.getService(self, Utilities)
+        service = zapi.getService(Utilities)
         ifaces = {}
         while service is not None:
             for reg in service.registrations():

Modified: Zope3/trunk/src/zope/app/apidoc/viewmodule/__init__.py
===================================================================
--- Zope3/trunk/src/zope/app/apidoc/viewmodule/__init__.py	2004-05-22 01:54:58 UTC (rev 24868)
+++ Zope3/trunk/src/zope/app/apidoc/viewmodule/__init__.py	2004-05-22 01:56:25 UTC (rev 24869)
@@ -158,7 +158,7 @@
 
     def isDefault(self):
         """Return whether this skin is the default skin."""
-        service = zapi.getService(self.context, 'Presentation')
+        service = zapi.getService('Presentation')
         for registration in service.registrations():
             if isinstance(registration, DefaultSkinRegistration) and \
                    registration.skin == self.context.skin:
@@ -173,7 +173,7 @@
 
         Each element of the list is a LayerDocumentation component.
         """
-        service = zapi.getService(self.context, 'Presentation')
+        service = zapi.getService('Presentation')
         layers = [zapi.getAdapter(reg, ILayerDocumentation)
                   for reg in service.registrations()
                   if (isinstance(reg, LayerRegistration) and

Modified: Zope3/trunk/src/zope/app/applicationcontrol/browser/servercontrol.py
===================================================================
--- Zope3/trunk/src/zope/app/applicationcontrol/browser/servercontrol.py	2004-05-22 01:54:58 UTC (rev 24868)
+++ Zope3/trunk/src/zope/app/applicationcontrol/browser/servercontrol.py	2004-05-22 01:56:25 UTC (rev 24869)
@@ -23,7 +23,7 @@
 class ServerControlView:
 
     def serverControl(self):
-        return zapi.getUtility(self.context, IServerControl)
+        return zapi.getUtility(IServerControl, context=self.context)
 
     def action(self, time=0):
         """Do the shutdown/restart!"""

Modified: Zope3/trunk/src/zope/app/applicationcontrol/browser/translationdomaincontrol.py
===================================================================
--- Zope3/trunk/src/zope/app/applicationcontrol/browser/translationdomaincontrol.py	2004-05-22 01:54:58 UTC (rev 24868)
+++ Zope3/trunk/src/zope/app/applicationcontrol/browser/translationdomaincontrol.py	2004-05-22 01:56:25 UTC (rev 24869)
@@ -41,7 +41,7 @@
             language = self.request.get('language')
             domain = self.request.get('domain')
 
-            domain = zapi.getUtility(None, ITranslationDomain, domain)
+            domain = zapi.getUtility(ITranslationDomain, domain)
             for lang, fileNames in domain.getCatalogsInfo().items():
                 if lang == language:
                     domain.reloadCatalogs(fileNames)

Modified: Zope3/trunk/src/zope/app/applicationcontrol/runtimeinfo.py
===================================================================
--- Zope3/trunk/src/zope/app/applicationcontrol/runtimeinfo.py	2004-05-22 01:54:58 UTC (rev 24868)
+++ Zope3/trunk/src/zope/app/applicationcontrol/runtimeinfo.py	2004-05-22 01:56:25 UTC (rev 24869)
@@ -53,7 +53,7 @@
     def getZopeVersion(self):
         """See zope.app.applicationcontrol.interfaces.IRuntimeInfo"""
         try:
-            version_utility = getUtility(self.context, IZopeVersion)
+            version_utility = getUtility(IZopeVersion, context=self.context)
         except ComponentLookupError:
             return ""
         return version_utility.getZopeVersion()

Modified: Zope3/trunk/src/zope/app/bundle/browser/__init__.py
===================================================================
--- Zope3/trunk/src/zope/app/bundle/browser/__init__.py	2004-05-22 01:54:58 UTC (rev 24868)
+++ Zope3/trunk/src/zope/app/bundle/browser/__init__.py	2004-05-22 01:56:25 UTC (rev 24869)
@@ -171,7 +171,7 @@
         name = self.getServiceName(obj)
         advice = ActiveStatus
         conflict = ""
-        sm = zapi.getServiceManager(obj)
+        sm = zapi.getServices(obj)
         service = sm.queryLocalService(name)
         if service:
             registry = service.queryRegistrationsFor(obj)

Modified: Zope3/trunk/src/zope/app/cache/annotationcacheable.py
===================================================================
--- Zope3/trunk/src/zope/app/cache/annotationcacheable.py	2004-05-22 01:54:58 UTC (rev 24868)
+++ Zope3/trunk/src/zope/app/cache/annotationcacheable.py	2004-05-22 01:56:25 UTC (rev 24869)
@@ -39,7 +39,7 @@
         # Remove object from old cache
         old_cache_id = self.getCacheId()
         if old_cache_id and old_cache_id != id:
-            cache = zapi.getUtility(self._context, ICache, old_cache_id)
+            cache = zapi.getUtility(ICache, old_cache_id)
             cache.invalidate(self._context)
         annotations = IAnnotations(self._context)
         annotations[annotation_key] = id

Modified: Zope3/trunk/src/zope/app/cache/caching.py
===================================================================
--- Zope3/trunk/src/zope/app/cache/caching.py	2004-05-22 01:54:58 UTC (rev 24868)
+++ Zope3/trunk/src/zope/app/cache/caching.py	2004-05-22 01:56:25 UTC (rev 24869)
@@ -25,7 +25,7 @@
     cache_id = adapter.getCacheId()
     if not cache_id:
         return None
-    return zapi.getUtility(obj, ICache, cache_id)
+    return zapi.getUtility(ICache, cache_id)
 
 def getLocationForCache(obj):
     """Returns the location to be used for caching the object or None."""

Modified: Zope3/trunk/src/zope/app/catalog/catalog.py
===================================================================
--- Zope3/trunk/src/zope/app/catalog/catalog.py	2004-05-22 01:54:58 UTC (rev 24868)
+++ Zope3/trunk/src/zope/app/catalog/catalog.py	2004-05-22 01:56:25 UTC (rev 24869)
@@ -55,7 +55,7 @@
 
     def __init__(self, catalog, event):
         self.catalog = catalog
-    
+
     def notify(self, event):
         """Receive notification of add events."""
         self.catalog.subscribeEvents(update=False)
@@ -81,7 +81,7 @@
     def _newContainerData(self):
         return PersistentDict()
 
-    def getSubscribed(self): 
+    def getSubscribed(self):
         return self._subscribed
 
     def clearIndexes(self):
@@ -90,7 +90,7 @@
 
     def updateIndexes(self):
         eventF = Hub.ObjectRegisteredHubEvent
-        objectHub = getService(self, HubIds) 
+        objectHub = getService(HubIds)
         allobj = objectHub.iterObjectRegistrations()
         for location, hubid, wrapped_object in allobj:
             evt = eventF(objectHub, hubid, location, wrapped_object)
@@ -98,20 +98,20 @@
                 index.notify(evt)
 
     def subscribeEvents(self, update=True):
-        if self._subscribed: 
+        if self._subscribed:
             raise ValueError, "Already subscribed"
         self._subscribed = True
-        objectHub = getService(self, HubIds) 
+        objectHub = getService(HubIds)
         objectHub.subscribe(self, IHub.IRegistrationHubEvent)
         objectHub.subscribe(self, IHub.IObjectModifiedHubEvent)
         if update:
             self.updateIndexes()
 
     def unsubscribeEvents(self):
-        if not self._subscribed: 
+        if not self._subscribed:
             raise ValueError, "Already unsubscribed"
         self._subscribed = False
-        objectHub = getService(self, HubIds) 
+        objectHub = getService(HubIds)
         try:
             objectHub.unsubscribe(self, IHub.IRegistrationHubEvent)
             objectHub.unsubscribe(self, IHub.IObjectModifiedHubEvent)
@@ -134,7 +134,7 @@
         pendingResults = None
         for key, value in searchterms.items():
             index = self.get(key)
-            if not index: 
+            if not index:
                 raise ValueError, "no such index %s"%(key)
             index = ISimpleQuery(index)
             results = index.query(value)
@@ -150,18 +150,18 @@
                 # nothing left, short-circuit
                 break
         # Next we turn the IISet of hubids into a generator of objects
-        objectHub = getService(self, HubIds) 
+        objectHub = getService(HubIds)
         results = ResultSet(pendingResults, objectHub)
         return results
 
 class CatalogUtility(CatalogBase):
     "A Catalog in service-space"
-    # Utilities will default to implementing the most specific 
+    # Utilities will default to implementing the most specific
     # interface. This piece of delightfulness is needed because
     # the interface resolution order machinery implements (no
     # pun intended) the old-style Python resolution order machinery.
     implements(ILocalUtility)
 
-class Catalog(CatalogBase): 
+class Catalog(CatalogBase):
     "A content-space Catalog"
     pass

Modified: Zope3/trunk/src/zope/app/catalog/tests.py
===================================================================
--- Zope3/trunk/src/zope/app/catalog/tests.py	2004-05-22 01:54:58 UTC (rev 24868)
+++ Zope3/trunk/src/zope/app/catalog/tests.py	2004-05-22 01:56:25 UTC (rev 24869)
@@ -27,12 +27,14 @@
 from zope.app.hub.interfaces import IObjectHub
 from zope.app.catalog.interfaces.index import ICatalogIndex
 from zope.index.interfaces import ISimpleQuery
+from zope.app.site.interfaces import ISite
+from zope.app import zapi
 
 from zope.app.catalog.catalog import Catalog
 from zope.app.catalog.catalog import CatalogBaseAddSubscriber
 from zope.app.catalog.catalog import CatalogBaseRemoveSubscriber
 from zope.app.tests.placelesssetup import PlacelessSetup
-from zope.component import getServiceManager
+from zope.component import getGlobalServices
 from zope.app.servicenames import HubIds
 from BTrees.IIBTree import IISet
 
@@ -52,6 +54,7 @@
                 yield loc,hubid,obj
         return gen(self.data.items())
 
+
 class StubIndex(object):
     implements(ISimpleQuery, ISubscriber, ICatalogIndex, IUIFieldCatalogIndex)
 
@@ -176,7 +179,7 @@
 
     def _frob_objecthub(self, ints=1, apes=1):
         hub = CFakeObjectHub()
-        service_manager = getServiceManager(None)
+        service_manager = getGlobalServices()
         service_manager.defineService(HubIds, IObjectHub)
         service_manager.provideService(HubIds, hub)
         # whack some objects in our little objecthub
@@ -247,4 +250,4 @@
 
 if __name__ == "__main__":
     unittest.main()
-        
+

Modified: Zope3/trunk/src/zope/app/component/interface.py
===================================================================
--- Zope3/trunk/src/zope/app/component/interface.py	2004-05-22 01:54:58 UTC (rev 24868)
+++ Zope3/trunk/src/zope/app/component/interface.py	2004-05-22 01:56:25 UTC (rev 24869)
@@ -145,7 +145,7 @@
     
     """
     
-    return zapi.queryUtility(None, IInterface, default, id)
+    return zapi.queryUtility(IInterface, default, id)
 
 def searchInterface(context, search_string=None, base=None):
     """Interfaces search

Modified: Zope3/trunk/src/zope/app/component/metaconfigure.py
===================================================================
--- Zope3/trunk/src/zope/app/component/metaconfigure.py	2004-05-22 01:54:58 UTC (rev 24868)
+++ Zope3/trunk/src/zope/app/component/metaconfigure.py	2004-05-22 01:56:25 UTC (rev 24869)
@@ -30,7 +30,7 @@
 
 PublicPermission = 'zope.Public'
 
-# I prefer the indirection (using getService and getServiceManager vs.
+# I prefer the indirection (using getService and getServices vs.
 # directly importing the various services)  not only because it makes
 # unit tests easier, but also because it reinforces that the services
 # should always be obtained through the
@@ -55,7 +55,7 @@
     handler(*args, **kw)
 
 def managerHandler(methodName, *args, **kwargs):
-    method=getattr(zapi.getServiceManager(None), methodName)
+    method=getattr(zapi.getGlobalServices(), methodName)
     method(*args, **kwargs)
 
 def interface(_context, interface, type=None):
@@ -390,7 +390,7 @@
     # We have to wait till execution time so we can find out the interface.
     # Waaaa.
 
-    service_manager = zapi.getServiceManager(None)
+    service_manager = zapi.getGlobalServices()
 
     if permission:
         for stype, interface in service_manager.getServiceDefinitions():

Modified: Zope3/trunk/src/zope/app/component/tests/test_contentdirective.py
===================================================================
--- Zope3/trunk/src/zope/app/component/tests/test_contentdirective.py	2004-05-22 01:54:58 UTC (rev 24868)
+++ Zope3/trunk/src/zope/app/component/tests/test_contentdirective.py	2004-05-22 01:56:25 UTC (rev 24869)
@@ -158,7 +158,7 @@
 </content>
                        """)
         xmlconfig(f)
-        factory = zapi.getUtility(None, IFactory, 'Example')
+        factory = zapi.getUtility(IFactory, 'Example')
         self.assertEquals(factory.title, "Example content")
         self.assertEquals(factory.description, "Example description")
 
@@ -177,8 +177,7 @@
         self.assertRaises(ComponentLookupError, zapi.getUtility,
                           None, IFactory, 'Example')
         factory = zapi.getUtility(
-            None, IFactory,
-            'zope.app.component.tests.exampleclass.ExampleClass')
+            IFactory, 'zope.app.component.tests.exampleclass.ExampleClass')
         self.assertEquals(factory.title, "Example content")
         self.assertEquals(factory.description, "Example description")
 
@@ -195,7 +194,7 @@
 </content>
             """)
         xmlconfig(f)
-        factory = zapi.getUtility(None, IFactory, 'Example')
+        factory = zapi.getUtility(IFactory, 'Example')
         self.assert_(hasattr(factory, '__Security_checker__'))
 
 

Modified: Zope3/trunk/src/zope/app/component/tests/test_directives.py
===================================================================
--- Zope3/trunk/src/zope/app/component/tests/test_directives.py	2004-05-22 01:54:58 UTC (rev 24868)
+++ Zope3/trunk/src/zope/app/component/tests/test_directives.py	2004-05-22 01:56:25 UTC (rev 24869)
@@ -364,7 +364,7 @@
         # Full import is critical!
         from zope.component.tests.components import IApp, comp
 
-        self.assertEqual(zapi.queryUtility(None, IV, None), None)
+        self.assertEqual(zapi.queryUtility(IV, None), None)
 
         xmlconfig(StringIO(template % (
             """
@@ -375,7 +375,7 @@
             """
             )))
 
-        self.assertEqual(zapi.getUtility(None, IApp), comp)
+        self.assertEqual(zapi.getUtility(IApp), comp)
 
     def testNamedUtility(self):
 
@@ -384,7 +384,7 @@
 
         self.testUtility()
 
-        self.assertEqual(zapi.queryUtility(None, IV, None, name='test'), None)
+        self.assertEqual(zapi.queryUtility(IV, None, name='test'), None)
 
         xmlconfig(StringIO(template % (
             """
@@ -396,14 +396,14 @@
             """
             )))
 
-        self.assertEqual(zapi.getUtility(None, IApp, "test"), comp)
+        self.assertEqual(zapi.getUtility(IApp, "test"), comp)
 
     def testUtilityFactory(self):
 
         # Full import is critical!
         from zope.component.tests.components import IApp, Comp
 
-        self.assertEqual(zapi.queryUtility(None, IV, None), None)
+        self.assertEqual(zapi.queryUtility(IV, None), None)
 
         xmlconfig(StringIO(template % (
             """
@@ -414,14 +414,14 @@
             """
             )))
 
-        self.assertEqual(zapi.getUtility(None, IApp).__class__, Comp)
+        self.assertEqual(zapi.getUtility(IApp).__class__, Comp)
 
     def testProtectedUtility(self):
 
         # Full import is critical!
         from zope.component.tests.components import IApp, comp
 
-        self.assertEqual(zapi.queryUtility(None, IV, None), None)
+        self.assertEqual(zapi.queryUtility(IV, None), None)
 
         xmlconfig(StringIO(template % (
             """
@@ -433,7 +433,7 @@
             """
             )))
 
-        utility = ProxyFactory(zapi.getUtility(None, IApp))
+        utility = ProxyFactory(zapi.getUtility(IApp))
         items = [item[0] for item in getTestProxyItems(utility)]
         self.assertEqual(items, ['a', 'f'])
         self.assertEqual(getProxiedObject(utility), comp)
@@ -771,7 +771,7 @@
 
         ob = Ob()
         self.assertEqual(
-            zapi.queryResource(ob, 'test', Request(IV), None), None)
+            zapi.queryResource('test', Request(IV), None), None)
         xmlconfig(StringIO(template % (
             """
             <resource name="test"
@@ -780,15 +780,14 @@
             """
             )))
 
-        self.assertEqual(zapi.queryResource(ob, 'test', Request(IV), None
-                                            ).__class__,
-                         R1)
+        self.assertEqual(
+            zapi.queryResource('test', Request(IV), None).__class__,
+            R1)
 
     def testResourceThatProvidesAnInterface(self):
 
         ob = Ob()
-        self.assertEqual(
-            zapi.queryResource(ob, 'test', Request(IV), None), None)
+        self.assertEqual(zapi.queryResource('test', Request(IV), None), None)
 
         xmlconfig(StringIO(template %
             '''
@@ -800,7 +799,7 @@
             '''
             ))
 
-        v = zapi.queryResource(ob, 'test', Request(IR), None, providing=IV)
+        v = zapi.queryResource('test', Request(IR), None, providing=IV)
         self.assertEqual(v, None)
 
         xmlconfig(StringIO(template %
@@ -814,14 +813,14 @@
             '''
             ))
 
-        v = zapi.queryResource(ob, 'test', Request(IR), None, providing=IV)
+        v = zapi.queryResource('test', Request(IR), None, providing=IV)
 
         self.assertEqual(v.__class__, R1)
 
     def testUnnamedResourceThatProvidesAnInterface(self):
 
         ob = Ob()
-        self.assertEqual(zapi.queryResource(ob, '', Request(IV), None), None)
+        self.assertEqual(zapi.queryResource('', Request(IV), None), None)
 
         xmlconfig(StringIO(template %
             '''
@@ -832,7 +831,7 @@
             '''
             ))
 
-        v = zapi.queryResource(ob, '', Request(IR), None, providing=IV)
+        v = zapi.queryResource('', Request(IR), None, providing=IV)
         self.assertEqual(v, None)
 
         xmlconfig(StringIO(template %
@@ -845,7 +844,7 @@
             '''
             ))
 
-        v = zapi.queryResource(ob, '', Request(IR), None, providing=IV)
+        v = zapi.queryResource('', Request(IR), None, providing=IV)
 
         self.assertEqual(v.__class__, R1)
 
@@ -866,7 +865,7 @@
 
         ob = Ob()
         self.assertEqual(
-            zapi.queryResource(ob, 'test', Request(IV), None), None)
+            zapi.queryResource('test', Request(IV), None), None)
 
         xmlconfig(StringIO(template % (
             '''
@@ -883,10 +882,10 @@
             )))
 
         self.assertEqual(
-            zapi.queryResource(ob, 'test', Request(IV), None).__class__,
+            zapi.queryResource('test', Request(IV), None).__class__,
             R1)
         self.assertEqual(
-            zapi.queryResource(ob, 'test', Request(IV, 'zmi'), None).__class__,
+            zapi.queryResource('test', Request(IV, 'zmi'), None).__class__,
             RZMI)
 
     def testFactory(self):

Modified: Zope3/trunk/src/zope/app/container/browser/adding.py
===================================================================
--- Zope3/trunk/src/zope/app/container/browser/adding.py	2004-05-22 01:54:58 UTC (rev 24868)
+++ Zope3/trunk/src/zope/app/container/browser/adding.py	2004-05-22 01:56:25 UTC (rev 24869)
@@ -76,7 +76,7 @@
     def nextURL(self):
         """See zope.app.container.interfaces.IAdding"""
         return (str(zapi.getView(self.context, "absolute_url", self.request))
-                + '/@@SelectedManagementView.html')
+                + '/@@contents.html')
 
     # set in BrowserView.__init__
     request = None 
@@ -106,7 +106,7 @@
         if view is not None:
             return view
 
-        factory = zapi.queryUtility(self.context, IFactory, name=name)
+        factory = zapi.queryUtility(IFactory, name=name)
         if factory is None:
             return super(BasicAdding, self).publishTraverse(request, name)
 
@@ -138,7 +138,7 @@
         #      then ProxyFactory does not the right thing and the original's
         #      checker info gets lost. No factory that was registered via ZCML
         #      and was used via addMenuItem worked here. (SR)
-        factory = zapi.getUtility(self, IFactory, type_name)
+        factory = zapi.getUtility(IFactory, type_name)
         if not type(factory) is zope.security.checker.Proxy:
             factory = LocationProxy(factory, self, type_name)
             factory = zope.security.checker.ProxyFactory(factory)
@@ -174,7 +174,7 @@
         This is sorted by title.
         """
         container = self.context
-        menu_service = zapi.getService(container, "BrowserMenu")
+        menu_service = zapi.getService("BrowserMenu")
         result = []
         for menu_id in (self.menu_id, 'zope.app.container.add'):
             if not menu_id:
@@ -184,7 +184,7 @@
                 if extra:
                     factory = extra.get('factory')
                     if factory:
-                        factory = zapi.getUtility(container, IFactory, factory)
+                        factory = zapi.getUtility(IFactory, factory)
                         if not checkFactory(container, None, factory):
                             continue
                         elif item['extra']['factory'] != item['action']:

Modified: Zope3/trunk/src/zope/app/container/browser/commontasks.pt
===================================================================
--- Zope3/trunk/src/zope/app/container/browser/commontasks.pt	2004-05-22 01:54:58 UTC (rev 24868)
+++ Zope3/trunk/src/zope/app/container/browser/commontasks.pt	2004-05-22 01:56:25 UTC (rev 24869)
@@ -1,9 +1,9 @@
 <tal:block define="addingInfo context/@@+/addingInfo|nothing"
            condition="addingInfo" i18n:domain="zope">
 
-  <tal:block repeat="info addingInfo" 
+  <tal:block repeat="info addingInfo"
 	define="namesRequired context/@@+/namesAccepted">
-    <div tal:define="oddrow repeat/info/odd; 
+    <div tal:define="oddrow repeat/info/odd;
 		     namesRequired context/@@+/namesAccepted;
         has_custom_add_view python:'has_custom_add_view' in info"
       	tal:attributes="class python:oddrow and 'content even' or 'content odd'"
@@ -17,10 +17,10 @@
           class info/selected"
         tal:content="info/title" i18n:translate="">Folder
       </a>
-      
+
       <a href="#"
         tal:define="baseurl python:request.getURL(1)"
-        tal:condition="python: not info['action'].startswith('../') 
+        tal:condition="python: not info['action'].startswith('../')
 		               and (has_custom_add_view or not namesRequired)"
         tal:attributes="
           href string:${baseurl}/@@+/action.html?type_name=${info/action};

Modified: Zope3/trunk/src/zope/app/container/browser/tests/test_contents.py
===================================================================
--- Zope3/trunk/src/zope/app/container/browser/tests/test_contents.py	2004-05-22 01:54:58 UTC (rev 24868)
+++ Zope3/trunk/src/zope/app/container/browser/tests/test_contents.py	2004-05-22 01:56:25 UTC (rev 24869)
@@ -31,7 +31,7 @@
 
 from zope.app.copypastemove.interfaces import IPrincipalClipboard
 from zope.app.copypastemove import PrincipalClipboard
-from zope.component import getServiceManager
+from zope.component import getServices, getGlobalServices
 from zope.app.principalannotation import PrincipalAnnotationService
 from zope.app.principalannotation.interfaces import IPrincipalAnnotationService
 from zope.app.annotation.interfaces import IAnnotations
@@ -56,11 +56,11 @@
 
         ztapi.provideAdapter(IAnnotations, IPrincipalClipboard,
                              PrincipalClipboard)
-        root_sm = getServiceManager(None)
+        global_sm = getGlobalServices()
         svc = PrincipalAnnotationService()
-        root_sm.defineService("PrincipalAnnotation", \
+        global_sm.defineService("PrincipalAnnotation", \
             IPrincipalAnnotationService)
-        root_sm.provideService("PrincipalAnnotation", svc)
+        global_sm.provideService("PrincipalAnnotation", svc)
 
     def testInfo(self):
         # Do we get the correct information back from ContainerContents?
@@ -165,11 +165,11 @@
 
         ztapi.provideAdapter(IAnnotations, IPrincipalClipboard,
                              PrincipalClipboard)
-        root_sm = getServiceManager(None)
+        global_sm = getGlobalServices()
         svc = PrincipalAnnotationService()
-        root_sm.defineService("PrincipalAnnotation", \
+        global_sm.defineService("PrincipalAnnotation", \
             IPrincipalAnnotationService)
-        root_sm.provideService("PrincipalAnnotation", svc)
+        global_sm.provideService("PrincipalAnnotation", svc)
 
     def testRename(self):
         container = traverse(self.rootFolder, 'folder1')

Modified: Zope3/trunk/src/zope/app/copypastemove/tests/test_clipboard.py
===================================================================
--- Zope3/trunk/src/zope/app/copypastemove/tests/test_clipboard.py	2004-05-22 01:54:58 UTC (rev 24868)
+++ Zope3/trunk/src/zope/app/copypastemove/tests/test_clipboard.py	2004-05-22 01:56:25 UTC (rev 24869)
@@ -36,14 +36,11 @@
 
         ztapi.provideAdapter(IAnnotations, IPrincipalClipboard,
                              PrincipalClipboard)
-        root_sm = zapi.getServiceManager(None)
+        root_sm = zapi.getGlobalServices()
         svc = PrincipalAnnotationService()
         root_sm.defineService("PrincipalAnnotation", \
             IPrincipalAnnotationService)
         root_sm.provideService("PrincipalAnnotation", svc)
-        sm = zapi.getServiceManager(self.rootFolder)
-        sm.PrincipalAnnotation = svc
-        self.svc = zapi.getService(self.rootFolder, "PrincipalAnnotation")
 
     def testAddItems(self):
         user = self._auth['one']['srichter']

Modified: Zope3/trunk/src/zope/app/dav/propfind.py
===================================================================
--- Zope3/trunk/src/zope/app/dav/propfind.py	2004-05-22 01:54:58 UTC (rev 24868)
+++ Zope3/trunk/src/zope/app/dav/propfind.py	2004-05-22 01:56:25 UTC (rev 24869)
@@ -198,7 +198,7 @@
                   if e.nodeType == e.ELEMENT_NODE]
         for node in childs:
             ns = node.namespaceURI
-            iface = zapi.queryUtility(None, IDAVNamespace, None, ns)
+            iface = zapi.queryUtility(IDAVNamespace, None, ns)
             value = _props.get(ns, {'iface': iface, 'props': []})
             value['props'].append(node.localName)
             _props[ns] = value
@@ -206,7 +206,7 @@
 
     def _handleAllprop(self, _avail_props, _props):
         for ns in _avail_props.keys():
-            iface = zapi.queryUtility(None, IDAVNamespace, None, ns)
+            iface = zapi.queryUtility(IDAVNamespace, None, ns)
             _props[ns] = {'iface': iface, 'props': _avail_props.get(ns)}
         return _props
 

Modified: Zope3/trunk/src/zope/app/event/__init__.py
===================================================================
--- Zope3/trunk/src/zope/app/event/__init__.py	2004-05-22 01:54:58 UTC (rev 24868)
+++ Zope3/trunk/src/zope/app/event/__init__.py	2004-05-22 01:56:25 UTC (rev 24869)
@@ -19,8 +19,9 @@
 from zope.app.event.interfaces import IEvent
 from zope.app.event.globalservice import eventPublisher
 
+# XXX convert these as well
 def getEventService(context): # the "publish" service
-    return getService(context, EventPublication)
+    return getService(EventPublication, context=context)
 
 def publish(context, event):
     return getEventService(context).publish(event)

Modified: Zope3/trunk/src/zope/app/event/localservice.py
===================================================================
--- Zope3/trunk/src/zope/app/event/localservice.py	2004-05-22 01:54:58 UTC (rev 24868)
+++ Zope3/trunk/src/zope/app/event/localservice.py	2004-05-22 01:56:25 UTC (rev 24869)
@@ -27,7 +27,7 @@
 
 from zope.component import ComponentLookupError
 from zope.app.servicenames import HubIds, EventPublication, EventSubscription
-from zope.app.component.nextservice import getNextService, queryNextService
+from zope.app.component.localservice import getNextService, queryNextService
 
 from zope.proxy import removeAllProxies
 from zope.interface import implements

Modified: Zope3/trunk/src/zope/app/event/tests/placelesssetup.py
===================================================================
--- Zope3/trunk/src/zope/app/event/tests/placelesssetup.py	2004-05-22 01:54:58 UTC (rev 24868)
+++ Zope3/trunk/src/zope/app/event/tests/placelesssetup.py	2004-05-22 01:56:25 UTC (rev 24869)
@@ -15,12 +15,12 @@
 
 $Id$
 """
-from zope.component import getServiceManager
 from zope.app.servicenames import EventPublication
 from zope.app.event.interfaces import IPublisher, ISubscriber, IObjectEvent
 from zope.app.event.globalservice import eventPublisher
 from zope.app.event.objectevent import objectEventNotifierInstance
 from zope.interface import implements
+from zope.component import getGlobalServices
 
 events = []
 
@@ -48,7 +48,7 @@
 class PlacelessSetup:
 
     def setUp(self):
-        sm = getServiceManager(None)
+        sm = getGlobalServices()
         defineService = sm.defineService
         provideService = sm.provideService
 

Modified: Zope3/trunk/src/zope/app/event/tests/test_directives.py
===================================================================
--- Zope3/trunk/src/zope/app/event/tests/test_directives.py	2004-05-22 01:54:58 UTC (rev 24868)
+++ Zope3/trunk/src/zope/app/event/tests/test_directives.py	2004-05-22 01:56:25 UTC (rev 24869)
@@ -27,7 +27,7 @@
 from zope.app.event.objectevent import ObjectModifiedEvent
 from zope.app.event.tests.test_eventpublisher import DummyEvent
 from zope.component.tests.placelesssetup import PlacelessSetup
-from zope.component import getServiceManager
+from zope.component import getGlobalServices
 from zope.app.servicenames import EventPublication
 from zope.app.event.interfaces import IEvent
 
@@ -36,9 +36,9 @@
     def setUp(self):
         super(Test, self).setUp()
         from zope.app.event.interfaces import IPublisher
-        getServiceManager(None).defineService(EventPublication, IPublisher)
+        getGlobalServices().defineService(EventPublication, IPublisher)
         from zope.app.event.globalservice import eventPublisher
-        getServiceManager(None).provideService(EventPublication, eventPublisher)
+        getGlobalServices().provideService(EventPublication, eventPublisher)
 
     def testSubscribe(self):
         from zope.app.event.tests.subscriber import subscriber

Modified: Zope3/trunk/src/zope/app/event/tests/test_logger.py
===================================================================
--- Zope3/trunk/src/zope/app/event/tests/test_logger.py	2004-05-22 01:54:58 UTC (rev 24868)
+++ Zope3/trunk/src/zope/app/event/tests/test_logger.py	2004-05-22 01:56:25 UTC (rev 24869)
@@ -19,7 +19,7 @@
 import logging
 
 from zope.component.tests.placelesssetup import PlacelessSetup
-from zope.component import getServiceManager
+from zope.component import getGlobalServices
 from zope.app.servicenames import EventPublication
 
 from zope.app.event import globalSubscribe, globalUnsubscribe, publish
@@ -42,8 +42,8 @@
 
     def setUp(self):
         super(TestLogger1, self).setUp()
-        getServiceManager(None).defineService(EventPublication, IPublisher)
-        getServiceManager(None).provideService(EventPublication, eventPublisher)
+        getGlobalServices().defineService(EventPublication, IPublisher)
+        getGlobalServices().provideService(EventPublication, eventPublisher)
         # futz a handler in for testing
         self.logger = logging.getLogger("Event.Logger")
         self.oldlevel = self.logger.level

Modified: Zope3/trunk/src/zope/app/form/browser/add.py
===================================================================
--- Zope3/trunk/src/zope/app/form/browser/add.py	2004-05-22 01:54:58 UTC (rev 24868)
+++ Zope3/trunk/src/zope/app/form/browser/add.py	2004-05-22 01:56:25 UTC (rev 24869)
@@ -87,7 +87,7 @@
                     kw[str(name)] = data[name]
 
         content = self.create(*args, **kw)
-        adapted = getAdapter(content, self.schema, context=self.context)
+        adapted = getAdapter(content, self.schema)
 
         errors = []
 

Modified: Zope3/trunk/src/zope/app/form/browser/sequencewidget.py
===================================================================
--- Zope3/trunk/src/zope/app/form/browser/sequencewidget.py	2004-05-22 01:54:58 UTC (rev 24868)
+++ Zope3/trunk/src/zope/app/form/browser/sequencewidget.py	2004-05-22 01:56:25 UTC (rev 24869)
@@ -102,8 +102,7 @@
         if self.subwidget:
             widget = self.subwidget(field, self.request)
         else:
-            widget = zapi.getViewProviding(field, IInputWidget, self.request,
-                                           context=self.context)
+            widget = zapi.getViewProviding(field, IInputWidget, self.request)
         widget.setPrefix('%s.%d.'%(self.name, i))
         return widget
 

Modified: Zope3/trunk/src/zope/app/fssync/committer.py
===================================================================
--- Zope3/trunk/src/zope/app/fssync/committer.py	2004-05-22 01:54:58 UTC (rev 24868)
+++ Zope3/trunk/src/zope/app/fssync/committer.py	2004-05-22 01:56:25 UTC (rev 24869)
@@ -382,7 +382,7 @@
                 location = context
                 parent = None
             # No factory; try using IFileFactory or IDirectoryFactory
-            as = getService(location, "Adapters")
+            as = getService("Adapters")
             isuffix = name.rfind(".")
             if isuffix >= 0:
                 suffix = name[isuffix:]

Modified: Zope3/trunk/src/zope/app/fssync/syncer.py
===================================================================
--- Zope3/trunk/src/zope/app/fssync/syncer.py	2004-05-22 01:54:58 UTC (rev 24868)
+++ Zope3/trunk/src/zope/app/fssync/syncer.py	2004-05-22 01:56:25 UTC (rev 24869)
@@ -27,7 +27,7 @@
     return str(getPath(obj))
 
 def getSerializer(obj):
-    syncService = getService(obj, 'FSRegistryService')
+    syncService = getService('FSRegistryService')
     return syncService.getSynchronizer(obj)
 
 def getAnnotations(obj):

Modified: Zope3/trunk/src/zope/app/i18n/tests/placelesssetup.py
===================================================================
--- Zope3/trunk/src/zope/app/i18n/tests/placelesssetup.py	2004-05-22 01:54:58 UTC (rev 24868)
+++ Zope3/trunk/src/zope/app/i18n/tests/placelesssetup.py	2004-05-22 01:56:25 UTC (rev 24869)
@@ -16,7 +16,6 @@
 $Id$
 """
 from zope.app.tests import ztapi
-from zope.component import getServiceManager
 from zope.i18n.interfaces import IUserPreferredCharsets
 from zope.i18n.interfaces import IUserPreferredLanguages
 from zope.publisher.browser import BrowserLanguages

Modified: Zope3/trunk/src/zope/app/i18n/tests/test_translationdomain.py
===================================================================
--- Zope3/trunk/src/zope/app/i18n/tests/test_translationdomain.py	2004-05-22 01:54:58 UTC (rev 24868)
+++ Zope3/trunk/src/zope/app/i18n/tests/test_translationdomain.py	2004-05-22 01:56:25 UTC (rev 24869)
@@ -229,7 +229,7 @@
     def setUp(self):
         setup.placefulSetUp()
         self.rootFolder = setup.buildSampleFolderTree()
-        sm = zapi.getServiceManager(None)
+        sm = zapi.getGlobalServices()
         de_catalog = MessageCatalog('de', 'default')
         de_catalog.setMessage('short_greeting', 'Hallo!', 10)
 

Modified: Zope3/trunk/src/zope/app/i18n/tests/testi18ndirectives.py
===================================================================
--- Zope3/trunk/src/zope/app/i18n/tests/testi18ndirectives.py	2004-05-22 01:54:58 UTC (rev 24868)
+++ Zope3/trunk/src/zope/app/i18n/tests/testi18ndirectives.py	2004-05-22 01:56:25 UTC (rev 24869)
@@ -41,7 +41,7 @@
 
     def testRegisterTranslations(self):
         eq = self.assertEqual
-        eq(zapi.queryUtility(None, ITranslationDomain), None)
+        eq(zapi.queryUtility(ITranslationDomain), None)
         xmlconfig.string(
             template % '''
             <configure package="zope.i18n.tests">
@@ -51,7 +51,7 @@
         path = os.path.join(os.path.dirname(zope.i18n.tests.__file__),
                             'locale', 'en',
                             'LC_MESSAGES', 'zope-i18n.mo')
-        util = zapi.getUtility(None, ITranslationDomain, name='zope-i18n')
+        util = zapi.getUtility(ITranslationDomain, name='zope-i18n')
         eq(util._catalogs, {'en': [unicode(path)]})
 
 

Modified: Zope3/trunk/src/zope/app/i18n/translationdomain.py
===================================================================
--- Zope3/trunk/src/zope/app/i18n/translationdomain.py	2004-05-22 01:54:58 UTC (rev 24868)
+++ Zope3/trunk/src/zope/app/i18n/translationdomain.py	2004-05-22 01:56:25 UTC (rev 24869)
@@ -27,7 +27,7 @@
 from zope.i18n.interfaces import INegotiator, ITranslationDomain
 from zope.i18n.simpletranslationdomain import SimpleTranslationDomain
 from zope.app.container.contained import Contained
-from zope.app.component.nextservice import getNextService
+from zope.app.component.localservice import getNextService
 from zope.component.servicenames import Utilities
 from zope.app.utility import UtilityRegistration
 
@@ -68,7 +68,7 @@
         if target_language is None and context is not None:
             avail_langs = self.getAvailableLanguages()
             # Let's negotiate the language to translate to. :)
-            negotiator = zapi.getUtility(self, INegotiator)
+            negotiator = zapi.getUtility(INegotiator, context=self)
             target_language = negotiator.getLanguage(avail_langs, context)
 
         # Get the translation. Default is the source text itself.
@@ -166,7 +166,7 @@
 
     def addLanguage(self, language):
         'See IWriteTranslationService'
-        catalog = zapi.createObject(self, 'Message Catalog', language)
+        catalog = zapi.createObject(None, 'Message Catalog', language)
         self[language] = catalog
 
 

Modified: Zope3/trunk/src/zope/app/index/browser/field/control.py
===================================================================
--- Zope3/trunk/src/zope/app/index/browser/field/control.py	2004-05-22 01:54:58 UTC (rev 24868)
+++ Zope3/trunk/src/zope/app/index/browser/field/control.py	2004-05-22 01:56:25 UTC (rev 24869)
@@ -31,7 +31,7 @@
 
     def __init__(self, context, request):
         super(ControlView, self).__init__(context, request)
-        self.hub = getService(context, HubIds)
+        self.hub = getService(HubIds)
 
     def interface_name(self):
         return interfaceToName(self.context, self.context.interface)

Modified: Zope3/trunk/src/zope/app/index/browser/field/tests.py
===================================================================
--- Zope3/trunk/src/zope/app/index/browser/field/tests.py	2004-05-22 01:54:58 UTC (rev 24868)
+++ Zope3/trunk/src/zope/app/index/browser/field/tests.py	2004-05-22 01:56:25 UTC (rev 24869)
@@ -18,7 +18,7 @@
 import unittest
 from zope.interface import implements
 from zope.publisher.browser import TestRequest
-from zope.component import getServiceManager
+from zope.component import getGlobalServices
 from zope.exceptions import NotFoundError
 
 from zope.app.tests.placelesssetup import PlacelessSetup
@@ -55,7 +55,7 @@
 
     def setUp(self):
         super(TestControlView, self).setUp()
-        service_manager = getServiceManager(None)
+        service_manager = getGlobalServices()
         service_manager.defineService(HubIds, IObjectHub)
         service_manager.provideService(HubIds, ObjectHubStub())
 

Modified: Zope3/trunk/src/zope/app/index/processors.py
===================================================================
--- Zope3/trunk/src/zope/app/index/processors.py	2004-05-22 01:54:58 UTC (rev 24868)
+++ Zope3/trunk/src/zope/app/index/processors.py	2004-05-22 01:56:25 UTC (rev 24869)
@@ -40,7 +40,7 @@
         list = IRankedHubIdList(query)
         batch = IBatchedResult(query)
 
-        objectHub = getService(self, HubIds)
+        objectHub = getService(HubIds)
 
         # XXX do we need wrapping for the objects returned by the hub?
         iterator = RankedObjectIterator(

Modified: Zope3/trunk/src/zope/app/index/tests/test_objectretrievingprocessor.py
===================================================================
--- Zope3/trunk/src/zope/app/index/tests/test_objectretrievingprocessor.py	2004-05-22 01:54:58 UTC (rev 24868)
+++ Zope3/trunk/src/zope/app/index/tests/test_objectretrievingprocessor.py	2004-05-22 01:56:25 UTC (rev 24869)
@@ -17,7 +17,7 @@
 from zope.interface import implements
 from zope.interface.verify import verifyObject
 
-from zope.component import getServiceManager
+from zope.component import getGlobalServices
 from zope.app.servicenames import HubIds
 
 from zope.app.tests.placelesssetup import PlacelessSetup
@@ -71,7 +71,7 @@
 
         # Register the objecthub as a service
         hub = FakeObjectHub()
-        service_manager = getServiceManager(None)
+        service_manager = getGlobalServices()
         service_manager.defineService(HubIds, IObjectHub)
         service_manager.provideService(HubIds, hub)
 

Modified: Zope3/trunk/src/zope/app/introspector/__init__.py
===================================================================
--- Zope3/trunk/src/zope/app/introspector/__init__.py	2004-05-22 01:54:58 UTC (rev 24868)
+++ Zope3/trunk/src/zope/app/introspector/__init__.py	2004-05-22 01:56:25 UTC (rev 24869)
@@ -18,7 +18,7 @@
 from zope.interface import Interface
 from zope.app.introspector.interfaces import IIntrospector
 from zope.app.module.interfaces import IModuleService
-from zope.component import getService, getServiceDefinitions
+from zope.component import getService, getServiceDefinitions, getServices
 from zope.proxy import removeAllProxies
 from zope.interface import implements, implementedBy
 from zope.interface import directlyProvides, directlyProvidedBy, providedBy
@@ -52,7 +52,7 @@
         if path.find('++module++') != -1:
             if (self.context == Interface and
                 name != 'Interface._Interface.Interface'):
-                servicemanager = getServiceManager(self.context)
+                servicemanager = getServices()
                 adapter = IModuleService(servicemanager)
                 self.currentclass = adapter.resolve(name)
                 self.context = self.currentclass

Modified: Zope3/trunk/src/zope/app/introspector/browser.py
===================================================================
--- Zope3/trunk/src/zope/app/introspector/browser.py	2004-05-22 01:54:58 UTC (rev 24868)
+++ Zope3/trunk/src/zope/app/introspector/browser.py	2004-05-22 01:56:25 UTC (rev 24869)
@@ -58,7 +58,7 @@
 
     def getServicesFor(self):
         services = []
-        #sm = getServiceManager(self.context)
+        #sm = getServices()
         #for stype, interface in sm.getServiceDefinitions():
         #    try:
         #        service = getService(self.context, stype)

Modified: Zope3/trunk/src/zope/app/mail/metaconfigure.py
===================================================================
--- Zope3/trunk/src/zope/app/mail/metaconfigure.py	2004-05-22 01:54:58 UTC (rev 24868)
+++ Zope3/trunk/src/zope/app/mail/metaconfigure.py	2004-05-22 01:56:25 UTC (rev 24869)
@@ -45,7 +45,7 @@
         utilities = zapi.getService(None, 'Utilities')
         handler('Utilities', 'provideUtility', IMailDelivery, delivery, name)
 
-        mailerObject = zapi.queryUtility(None, IMailer, name=mailer)
+        mailerObject = zapi.queryUtility(IMailer, name=mailer)
         if mailerObject is None:
             raise ConfigurationError("Mailer %r is not defined" %mailer)
 
@@ -64,7 +64,7 @@
 def directDelivery(_context, permission, mailer, name="Mail"):
 
     def createDirectDelivery():
-        mailerObject = zapi.queryUtility(None, IMailer, name=mailer)
+        mailerObject = zapi.queryUtility(IMailer, name=mailer)
         if mailerObject is None:
             raise ConfigurationError("Mailer %r is not defined" %mailer)
 

Modified: Zope3/trunk/src/zope/app/mail/tests/test_directives.py
===================================================================
--- Zope3/trunk/src/zope/app/mail/tests/test_directives.py	2004-05-22 01:54:58 UTC (rev 24868)
+++ Zope3/trunk/src/zope/app/mail/tests/test_directives.py	2004-05-22 01:56:25 UTC (rev 24869)
@@ -81,21 +81,21 @@
         shutil.rmtree(self.mailbox, True)
 
     def testQueuedDelivery(self):
-        delivery = zapi.getUtility(None, IMailDelivery, "Mail")
+        delivery = zapi.getUtility(IMailDelivery, "Mail")
         self.assertEqual('QueuedMailDelivery', delivery.__class__.__name__)
         self.assertEqual(self.mailbox, delivery.queuePath)
 
     def testDirectDelivery(self):
-        delivery = zapi.getUtility(None, IMailDelivery, "Mail2")
+        delivery = zapi.getUtility(IMailDelivery, "Mail2")
         self.assertEqual('DirectMailDelivery', delivery.__class__.__name__)
         self.assert_(self.testMailer is delivery.mailer)
 
     def testSendmailMailer(self):
-        mailer = zapi.getUtility(None, IMailer, "Sendmail")
+        mailer = zapi.getUtility(IMailer, "Sendmail")
         self.assert_(ISendmailMailer.providedBy(mailer))
 
     def testSMTPMailer(self):
-        mailer = zapi.getUtility(None, IMailer, "smtp")
+        mailer = zapi.getUtility(IMailer, "smtp")
         self.assert_(ISMTPMailer.providedBy(mailer))
 
 

Modified: Zope3/trunk/src/zope/app/menu/__init__.py
===================================================================
--- Zope3/trunk/src/zope/app/menu/__init__.py	2004-05-22 01:54:58 UTC (rev 24868)
+++ Zope3/trunk/src/zope/app/menu/__init__.py	2004-05-22 01:56:25 UTC (rev 24869)
@@ -20,7 +20,7 @@
 from zope.component.exceptions import ComponentLookupError
 
 from zope.app import zapi
-from zope.app.component.nextservice import getNextService
+from zope.app.component.localservice import getNextService
 from zope.app.container.ordered import OrderedContainer
 from interfaces import ILocalBrowserMenu, ILocalBrowserMenuService
 from zope.app.publisher.interfaces.browser import \

Modified: Zope3/trunk/src/zope/app/menu/browser/__init__.py
===================================================================
--- Zope3/trunk/src/zope/app/menu/browser/__init__.py	2004-05-22 01:54:58 UTC (rev 24868)
+++ Zope3/trunk/src/zope/app/menu/browser/__init__.py	2004-05-22 01:56:25 UTC (rev 24869)
@@ -19,7 +19,7 @@
 from zope.app.publisher.browser import BrowserView
 from zope.app import zapi
 from zope.app.container.browser.contents import Contents
-from zope.app.component.nextservice import queryNextService
+from zope.app.component.localservice import queryNextService
 from zope.app.dublincore.interfaces import IZopeDublinCore
 from zope.app.menu.interfaces import ILocalBrowserMenu
 from zope.app.servicenames import Utilities, BrowserMenu

Modified: Zope3/trunk/src/zope/app/menu/browser/tests.py
===================================================================
--- Zope3/trunk/src/zope/app/menu/browser/tests.py	2004-05-22 01:54:58 UTC (rev 24868)
+++ Zope3/trunk/src/zope/app/menu/browser/tests.py	2004-05-22 01:56:25 UTC (rev 24869)
@@ -18,7 +18,7 @@
 import unittest
 
 from zope.interface import Interface, implements
-from zope.component import getServiceManager
+from zope.component import getServices, getGlobalServices
 
 from zope.security.management import newInteraction
 from zope.security.checker import defineChecker, NamesChecker, CheckerPublic
@@ -82,8 +82,8 @@
 
     def setUp(self):
         PlacefulSetup.setUp(self)
-        defineService = getServiceManager(None).defineService
-        provideService = getServiceManager(None).provideService
+        defineService = getGlobalServices().defineService
+        provideService = getGlobalServices().provideService
 
 
         defineService('BrowserMenu', IBrowserMenuService)

Modified: Zope3/trunk/src/zope/app/menu/tests.py
===================================================================
--- Zope3/trunk/src/zope/app/menu/tests.py	2004-05-22 01:54:58 UTC (rev 24868)
+++ Zope3/trunk/src/zope/app/menu/tests.py	2004-05-22 01:56:25 UTC (rev 24869)
@@ -31,7 +31,7 @@
 from zope.app.utility import LocalUtilityService, UtilityRegistration
 from zope.app.servicenames import BrowserMenu, Utilities
 from zope.app.tests import setup
-from zope.component import getServiceManager
+from zope.component import getGlobalServices
 from zope.component.exceptions import ComponentLookupError
 from zope.interface import Interface, implements, classImplements
 from zope.publisher.browser import TestRequest
@@ -89,7 +89,7 @@
         self.rootFolder = setup.buildSampleFolderTree()
 
         # Define Menu Service
-        sm=getServiceManager(None)
+        sm = getGlobalServices()
         sm.defineService(BrowserMenu, IBrowserMenuService)
         sm.provideService(BrowserMenu, globalBrowserMenuService)
         classImplements(LocalBrowserMenu, ILocalUtility)

Modified: Zope3/trunk/src/zope/app/pagetemplate/engine.py
===================================================================
--- Zope3/trunk/src/zope/app/pagetemplate/engine.py	2004-05-22 01:54:58 UTC (rev 24868)
+++ Zope3/trunk/src/zope/app/pagetemplate/engine.py	2004-05-22 01:56:25 UTC (rev 24869)
@@ -97,7 +97,7 @@
         # XXX This is only needed when self.evaluateInlineCode is true,
         # so should only be needed for zope.app.pythonpage.
         from zope.app.interpreter.interfaces import IInterpreter
-        interpreter = zapi.queryUtility(self.context, IInterpreter, name=lang)
+        interpreter = zapi.queryUtility(IInterpreter, name=lang)
         if interpreter is None:
             error = _('No interpreter named "${lang_name}" was found.')
             error.mapping = {'lang_name': lang}

Modified: Zope3/trunk/src/zope/app/pluggableauth/__init__.py
===================================================================
--- Zope3/trunk/src/zope/app/pluggableauth/__init__.py	2004-05-22 01:54:58 UTC (rev 24868)
+++ Zope3/trunk/src/zope/app/pluggableauth/__init__.py	2004-05-22 01:56:25 UTC (rev 24869)
@@ -45,7 +45,7 @@
 from zope.app.servicenames import Authentication
 from zope.app.security.interfaces import ILoginPassword
 from zope.app.site.interfaces import ISimpleService
-from zope.app.component.nextservice import queryNextService
+from zope.app.component.localservice import queryNextService
 
 from interfaces import IUserSchemafied, IPluggableAuthenticationService
 from interfaces import \

Modified: Zope3/trunk/src/zope/app/presentation/presentation.py
===================================================================
--- Zope3/trunk/src/zope/app/presentation/presentation.py	2004-05-22 01:54:58 UTC (rev 24868)
+++ Zope3/trunk/src/zope/app/presentation/presentation.py	2004-05-22 01:56:25 UTC (rev 24869)
@@ -22,7 +22,6 @@
 from zope.component.presentation import IDefaultViewName
 from zope.component.presentation import PresentationRegistration
 
-import zope.app.component.nextservice
 import zope.app.container.contained
 import zope.app.event.interfaces
 import zope.app.registration.interfaces
@@ -451,7 +450,7 @@
 
     def factory(self):
         self.validate()
-        sm = zapi.getServiceManager(self)
+        sm = zapi.getServices(self)
 
         if self.factoryName:
             folder = self.__parent__.__parent__

Modified: Zope3/trunk/src/zope/app/principalannotation/__init__.py
===================================================================
--- Zope3/trunk/src/zope/app/principalannotation/__init__.py	2004-05-22 01:54:58 UTC (rev 24868)
+++ Zope3/trunk/src/zope/app/principalannotation/__init__.py	2004-05-22 01:56:25 UTC (rev 24869)
@@ -24,7 +24,7 @@
 from persistent import Persistent
 from persistent.dict import PersistentDict
 from BTrees.OOBTree import OOBTree
-from zope.app.component.nextservice import queryNextService
+from zope.app.component.localservice import queryNextService
 from zope.app.annotation.interfaces import IAnnotations
 from zope.interface import implements
 
@@ -84,20 +84,18 @@
         # be saved in if we ever change
         self._v_store = store
 
-    def __getitem__(wrapped_self, key):
+    def __getitem__(self, key):
         try:
-            return wrapped_self.data[key]
+            return self.data[key]
         except KeyError:
             # We failed locally: delegate to a higher-level service.
-            service = queryNextService(wrapped_self, 'PrincipalAnnotation')
+            service = queryNextService(self, 'PrincipalAnnotation')
             if service is not None:
-                annotations = service.getAnnotationsById(
-                    wrapped_self.principalId)
+                annotations = service.getAnnotationsById(self.principalId)
                 return annotations[key]
             raise
 
     def __setitem__(self, key, value):
-
         if getattr(self, '_v_store', None) is not None:
             # _v_store is used to remember a mapping object that we should
             # be saved in if we ever change

Modified: Zope3/trunk/src/zope/app/principalannotation/tests.py
===================================================================
--- Zope3/trunk/src/zope/app/principalannotation/tests.py	2004-05-22 01:54:58 UTC (rev 24868)
+++ Zope3/trunk/src/zope/app/principalannotation/tests.py	2004-05-22 01:56:25 UTC (rev 24869)
@@ -17,7 +17,6 @@
 """
 from unittest import TestCase, TestLoader, TextTestRunner
 from zope.app.site.tests.placefulsetup import PlacefulSetup
-from zope.component import getServiceManager
 from zope.app.principalannotation import \
      PrincipalAnnotationService, AnnotationsForPrincipal
 from interfaces import IPrincipalAnnotationService
@@ -26,8 +25,8 @@
 from zope.app.security.interfaces import IPrincipal
 from zope.app.tests import setup
 from zope.interface import implements
+from zope.app import zapi
 
-
 class Principal:
 
     implements(IPrincipal)
@@ -42,7 +41,7 @@
         PlacefulSetup.setUp(self)
         sm = self.buildFolders(site='/')
 
-        root_sm = getServiceManager(None)
+        root_sm = zapi.getGlobalServices()
 
         svc = PrincipalAnnotationService()
 

Modified: Zope3/trunk/src/zope/app/publisher/browser/resources.py
===================================================================
--- Zope3/trunk/src/zope/app/publisher/browser/resources.py	2004-05-22 01:54:58 UTC (rev 24868)
+++ Zope3/trunk/src/zope/app/publisher/browser/resources.py	2004-05-22 01:56:25 UTC (rev 24869)
@@ -33,7 +33,7 @@
     def publishTraverse(self, request, name):
         '''See interface IBrowserPublisher'''
 
-        resource_service = zapi.getService(self, Presentation)
+        resource_service = zapi.getService(Presentation)
         resource = resource_service.queryResource(name, request)
         if resource is None:
             raise NotFoundError(self, name)

Modified: Zope3/trunk/src/zope/app/publisher/browser/tests/test_directives.py
===================================================================
--- Zope3/trunk/src/zope/app/publisher/browser/tests/test_directives.py	2004-05-22 01:54:58 UTC (rev 24868)
+++ Zope3/trunk/src/zope/app/publisher/browser/tests/test_directives.py	2004-05-22 01:56:25 UTC (rev 24869)
@@ -276,9 +276,7 @@
         self.assert_(issubclass(v.__class__, VZMI))
 
     def testI18nResource(self):
-        self.assertEqual(queryResource(ob, 'test', request,
-                                       None),
-                         None)
+        self.assertEqual(queryResource('test', request, None), None)
 
         path1 = os.path.join(tests_path, 'testfiles', 'test.pt')
         path2 = os.path.join(tests_path, 'testfiles', 'test2.pt')
@@ -292,9 +290,9 @@
             """ % (path1, path2)
             )))
 
-        v = getResource(ob, 'test', request)
+        v = getResource('test', request)
         self.assertEqual(
-            queryResource(ob, 'test', request).__class__,
+            queryResource('test', request).__class__,
             I18nFileResource)
         self.assertEqual(v._testData('en'), open(path1, 'rb').read())
         self.assertEqual(v._testData('fr'), open(path2, 'rb').read())
@@ -750,8 +748,7 @@
     def testFile(self):
         path = os.path.join(tests_path, 'testfiles', 'test.pt')
 
-        self.assertEqual(queryResource(ob, 'test', request),
-                         None)
+        self.assertEqual(queryResource('test', request), None)
 
         xmlconfig(StringIO(template %
             """
@@ -762,7 +759,7 @@
             """ % path
             ))
 
-        r = ProxyFactory(getResource(ob, 'index.html', request))
+        r = ProxyFactory(getResource('index.html', request))
 
         # Make sure we can access available attrs and not others
         for n in ('GET', 'HEAD', 'publishTraverse', 'request', '__call__'):
@@ -776,7 +773,7 @@
 
     def testSkinResource(self):
         self.assertEqual(
-            queryResource(ob, 'test', request, None),
+            queryResource('test', request, None),
             None)
 
         path = os.path.join(tests_path, 'testfiles', 'test.pt')
@@ -790,9 +787,9 @@
             """ % path
             )))
 
-        self.assertEqual(queryResource(ob, 'test', request), None)
+        self.assertEqual(queryResource('test', request), None)
 
-        r = getResource(ob, 'test', TestRequest(skin='zmi'))
+        r = getResource('test', TestRequest(skin='zmi'))
         r = removeAllProxies(r)
         self.assertEqual(r._testData(), open(path, 'rb').read())
 

Modified: Zope3/trunk/src/zope/app/publisher/browser/tests/test_icondirective.py
===================================================================
--- Zope3/trunk/src/zope/app/publisher/browser/tests/test_icondirective.py	2004-05-22 01:54:58 UTC (rev 24868)
+++ Zope3/trunk/src/zope/app/publisher/browser/tests/test_icondirective.py	2004-05-22 01:56:25 UTC (rev 24869)
@@ -89,7 +89,7 @@
             'width="16" height="16" border="0" />'
             % rname)
 
-        resource = ProxyFactory(getResource(ob, rname, request))
+        resource = ProxyFactory(getResource(rname, request))
         self.assertRaises(Forbidden, getattr, resource, '_testData')
         resource = removeAllProxies(resource)
         self.assertEqual(resource._testData(), open(path, 'rb').read())
@@ -119,7 +119,7 @@
             'height="16" border="0" />'
             % rname)
 
-        resource = ProxyFactory(getResource(ob, rname, request))
+        resource = ProxyFactory(getResource(rname, request))
 
         self.assertRaises(Forbidden, getattr, resource, '_testData')
         resource = removeAllProxies(resource)

Modified: Zope3/trunk/src/zope/app/publisher/fieldconverters.py
===================================================================
--- Zope3/trunk/src/zope/app/publisher/fieldconverters.py	2004-05-22 01:54:58 UTC (rev 24868)
+++ Zope3/trunk/src/zope/app/publisher/fieldconverters.py	2004-05-22 01:56:25 UTC (rev 24869)
@@ -46,7 +46,7 @@
     #
     # Option 2:  Use a utility (or perhaps a view, for L10N).
     #
-    #   tz_lookup = getUtility(None, ITimezoneLookup)
+    #   tz_lookup = getUtility(ITimezoneLookup)
     #   tzinfo = tz_lookup(tzname)
     #
     return datetime(year, month, day, hour, minute, second,

Modified: Zope3/trunk/src/zope/app/pythonpage/__init__.py
===================================================================
--- Zope3/trunk/src/zope/app/pythonpage/__init__.py	2004-05-22 01:54:58 UTC (rev 24868)
+++ Zope3/trunk/src/zope/app/pythonpage/__init__.py	2004-05-22 01:56:25 UTC (rev 24869)
@@ -205,7 +205,7 @@
         kw['script'] = self
         kw['context'] = zapi.getParent(self)
 
-        service = zapi.getService(self, Utilities)
+        service = zapi.getService(Utilities)
         interpreter = service.queryUtility(IInterpreter,
                                            name='text/server-python')
         return interpreter.evaluate(self._v_compiled, kw)

Modified: Zope3/trunk/src/zope/app/rdb/tests/test_directives.py
===================================================================
--- Zope3/trunk/src/zope/app/rdb/tests/test_directives.py	2004-05-22 01:54:58 UTC (rev 24868)
+++ Zope3/trunk/src/zope/app/rdb/tests/test_directives.py	2004-05-22 01:56:25 UTC (rev 24869)
@@ -31,11 +31,11 @@
 
         conns = list(zapi.getUtilitiesFor(None, IZopeDatabaseAdapter))
         self.assertEqual(conns, [])
-        connectionstub = queryUtility(None,IZopeDatabaseAdapter, None, 'stub')
+        connectionstub = queryUtility(IZopeDatabaseAdapter, None, 'stub')
         self.assertEqual(connectionstub, None)
 
         self.context = xmlconfig.file("rdb.zcml", zope.app.rdb.tests)
-        connectionstub = queryUtility(None,IZopeDatabaseAdapter, None, 'stub')
+        connectionstub = queryUtility(IZopeDatabaseAdapter, None, 'stub')
         connection = connectionstub()
         self.assertEqual(connectionstub.__class__, DAStub)
         conns = zapi.getUtilitiesFor(None, IZopeDatabaseAdapter)

Modified: Zope3/trunk/src/zope/app/registration/browser/__init__.py
===================================================================
--- Zope3/trunk/src/zope/app/registration/browser/__init__.py	2004-05-22 01:54:58 UTC (rev 24868)
+++ Zope3/trunk/src/zope/app/registration/browser/__init__.py	2004-05-22 01:56:25 UTC (rev 24869)
@@ -28,7 +28,7 @@
 from zope.app.registration.interfaces import RegisteredStatus
 from zope.app.registration.interfaces import UnregisteredStatus
 from zope.app.traversing import getName, traverse
-from zope.component import getView, getServiceManager
+from zope.component import getView, getServices
 from zope.interface import implements
 from zope.proxy import removeAllProxies
 
@@ -123,9 +123,8 @@
 
         message = self.applyUpdates()
 
-        self.configBase = str(getView(getServiceManager(self.context),
-                                      'absolute_url', self.request)
-                              )
+        self.configBase = str(getView(getServices(self.context), 'absolute_url',
+                                      self.request))
 
         registrations = self.context.info()
 
@@ -142,7 +141,7 @@
             reg = info['registration']
             info['summary'] = reg.implementationSummary()
             info['id'] = zpi.getPath(reg)
-            
+
         # Add a dummy registration since the stack removes trailing None.
         registrations.append({"active": False,
                               "id": "disable",

Modified: Zope3/trunk/src/zope/app/registration/registration.py
===================================================================
--- Zope3/trunk/src/zope/app/registration/registration.py	2004-05-22 01:54:58 UTC (rev 24868)
+++ Zope3/trunk/src/zope/app/registration/registration.py	2004-05-22 01:56:25 UTC (rev 24869)
@@ -90,7 +90,7 @@
     def _get_service(self, registration):
         # how we get the service is factored out so subclasses can
         # approach this differently
-        sm = zapi.getServiceManager(registration)
+        sm = zapi.getServices(registration)
         return sm.queryLocalService(registration.serviceType)
 
 
@@ -380,7 +380,7 @@
         # on construction.
 
         data = []
-        sm = zapi.getServiceManager(self)
+        sm = zapi.getServices(self)
         for path in self._data:
             if isinstance(path, basestring):
                 try:
@@ -583,7 +583,7 @@
         return self.componentPath
 
     def getComponent(self):
-        service_manager = zapi.getServiceManager(self)
+        service_manager = zapi.getServices(self)
 
         # The user of the registration object may not have permission
         # to traverse to the component.  Yet they should be able to

Modified: Zope3/trunk/src/zope/app/renderer/vocabulary.py
===================================================================
--- Zope3/trunk/src/zope/app/renderer/vocabulary.py	2004-05-22 01:54:58 UTC (rev 24868)
+++ Zope3/trunk/src/zope/app/renderer/vocabulary.py	2004-05-22 01:56:25 UTC (rev 24869)
@@ -23,4 +23,4 @@
 def SourceTypeVocabulary(context):
     return SimpleVocabulary(
         [SimpleTerm(name, title=factory.title) for name, factory in 
-         zapi.getFactoriesFor(None, ISource)])
+         zapi.getFactoriesFor(ISource)])

Modified: Zope3/trunk/src/zope/app/rotterdam/template.pt
===================================================================
--- Zope3/trunk/src/zope/app/rotterdam/template.pt	2004-05-22 01:54:58 UTC (rev 24868)
+++ Zope3/trunk/src/zope/app/rotterdam/template.pt	2004-05-22 01:56:25 UTC (rev 24869)
@@ -48,12 +48,12 @@
             User
           </tal:block>
         </metal:block>
-          <a href="" 
+          <a href=""
             tal:attributes="href string:@@logout.html?nextURL=${request/URL}"
             tal:condition="python: hasattr(request.principal, 'getLogin')"
             i18n:translate="">
             [Logout]</a>
-          <a href="" 
+          <a href=""
             tal:attributes="href string:@@login.html?nextURL=${request/URL}"
             tal:condition="python: not hasattr(request.principal, 'getLogin')"
             i18n:translate="">
@@ -68,7 +68,7 @@
       <metal:tree use-macro="context/@@standard_macros/navigation_tree_box" />
 
       <tal:block condition="python: macroname == 'view'">
-      
+
         <div class="box" id="commonTasks"
              tal:define="view context/@@commonTasks|nothing"
              tal:condition="view/strip|nothing">
@@ -84,7 +84,7 @@
       <!-- Tree of the help topics that appears on the help namespace -->
       <div class="box" id="help"
            tal:condition="not:python:request.getURL().find('++help++')==-1">
-        <h4 i18n:translate="">Online Help - TOC</h4>              
+        <h4 i18n:translate="">Online Help - TOC</h4>
         <div class="body">
           <div tal:content="structure view/getTopicTree|nothing"
                tal:omit-tag="">content of topicTree</div>
@@ -152,7 +152,7 @@
                                            ,toolbar=yes
                                            ,menubar=yes'"
                tal:attributes="href python:'javascript:popup('
-                                           + url + ',' 
+                                           + url + ','
                                            + name + ','
                                            + settings +')'"
                tal:content="help_info/title"

Modified: Zope3/trunk/src/zope/app/schema/tests/test_fieldfactory.py
===================================================================
--- Zope3/trunk/src/zope/app/schema/tests/test_fieldfactory.py	2004-05-22 01:54:58 UTC (rev 24868)
+++ Zope3/trunk/src/zope/app/schema/tests/test_fieldfactory.py	2004-05-22 01:56:25 UTC (rev 24869)
@@ -46,21 +46,21 @@
                                  zope.app.schema)
 
     def testRegisterFields(self):
-        factory = zapi.getUtility(None, IFactory,
+        factory = zapi.getUtility(IFactory,
                                   'zope.schema._bootstrapfields.Text')
         self.assertEquals(factory.title, "Text Field")
         self.assertEquals(factory.description, "Text Field")
 
     def testGetFactoriesForIField(self):
-        factories = list(zapi.getFactoriesFor(None, IField))
+        factories = list(zapi.getFactoriesFor(IField))
         self.assertEqual(len(factories), 3)
 
     def testGetFactoriesForIText(self):
-        factories = list(zapi.getFactoriesFor(None, IText))
+        factories = list(zapi.getFactoriesFor(IText))
         self.assertEqual(len(factories), 2)
 
     def testGetFactoriesUnregistered(self):
-        factories = list(zapi.getFactoriesFor(None, IFoo))
+        factories = list(zapi.getFactoriesFor(IFoo))
         self.assertEqual(len(factories), 0)
 
 

Modified: Zope3/trunk/src/zope/app/schema/vocabulary.py
===================================================================
--- Zope3/trunk/src/zope/app/schema/vocabulary.py	2004-05-22 01:54:58 UTC (rev 24868)
+++ Zope3/trunk/src/zope/app/schema/vocabulary.py	2004-05-22 01:56:25 UTC (rev 24869)
@@ -38,7 +38,7 @@
 
     def get(self, context, name):
         """See zope.schema.interfaces.IVocabularyRegistry"""
-        factory = zapi.getUtility(context, IVocabularyFactory, name)
+        factory = zapi.getUtility(IVocabularyFactory, name)
         return factory(context)
 
 def _clear():

Modified: Zope3/trunk/src/zope/app/schemacontent/content.py
===================================================================
--- Zope3/trunk/src/zope/app/schemacontent/content.py	2004-05-22 01:54:58 UTC (rev 24868)
+++ Zope3/trunk/src/zope/app/schemacontent/content.py	2004-05-22 01:56:25 UTC (rev 24869)
@@ -91,7 +91,7 @@
         """Create a browser menu service for the menu item."""
         # Get the local service manager; not that we know it must exist,
         # otherwise this object would not be called.
-        sm = zapi.getServiceManager(self.context)
+        sm = zapi.getServices(self.context)
         # Get the default package and add a menu service called 'Menus-1'
         default = zapi.traverse(sm, 'default')
         default['Menus-1'] = LocalBrowserMenuService()
@@ -108,7 +108,7 @@
         """Create a menu."""
         # Create a menu and add it to the default package
         menu = LocalBrowserMenu()
-        sm = zapi.getServiceManager(self.context)
+        sm = zapi.getServices(self.context)
         default = zapi.traverse(sm, 'default')
         default[self.menuId] = menu
         # Register th emenu as a utility and activate it.
@@ -126,7 +126,7 @@
         # locally
         if self.create:
             # Get the servicem manager and the default package
-            sm = zapi.getServiceManager(self.context)
+            sm = zapi.getServices(self.context)
             default = zapi.traverse(sm, 'default')
             service = sm.queryService(BrowserMenu)
             # Check whether the service really exists locally; if not, create

Modified: Zope3/trunk/src/zope/app/schemacontent/tests/test_content.py
===================================================================
--- Zope3/trunk/src/zope/app/schemacontent/tests/test_content.py	2004-05-22 01:54:58 UTC (rev 24868)
+++ Zope3/trunk/src/zope/app/schemacontent/tests/test_content.py	2004-05-22 01:56:25 UTC (rev 24869)
@@ -34,7 +34,7 @@
 from zope.app.schemacontent.content import \
      ContentComponentDefinition, ContentComponentDefinitionRegistration, \
      ContentComponentDefinitionMenuItem, ContentComponentInstance
-from zope.component import getServiceManager
+from zope.component import getGlobalServices
 from zope.app.tests import ztapi
 from zope.component.exceptions import ComponentLookupError
 from zope.interface import Interface, classImplements
@@ -60,7 +60,7 @@
                              ContentComponentDefinitionMenuItem)
 
         # Define Menu Service
-        sm=getServiceManager(None)
+        sm = getGlobalServices()
         sm.defineService(BrowserMenu, IBrowserMenuService)
         sm.provideService(BrowserMenu, GlobalBrowserMenuService())
         classImplements(LocalBrowserMenu, ILocalUtility)
@@ -120,7 +120,7 @@
                              IContentComponentMenuItem,
                              ContentComponentDefinitionMenuItem)
         
-        sm=getServiceManager(None)
+        sm = getGlobalServices()
         sm.defineService(BrowserMenu, IBrowserMenuService)
         sm.provideService(BrowserMenu, GlobalBrowserMenuService())
 

Modified: Zope3/trunk/src/zope/app/security/permission.py
===================================================================
--- Zope3/trunk/src/zope/app/security/permission.py	2004-05-22 01:54:58 UTC (rev 24868)
+++ Zope3/trunk/src/zope/app/security/permission.py	2004-05-22 01:56:25 UTC (rev 24869)
@@ -50,7 +50,7 @@
     """
     if permission_id == CheckerPublic:
         return
-    if not zapi.queryUtility(context, IPermission, name=permission_id):
+    if not zapi.queryUtility(IPermission, name=permission_id, context=context):
         raise ValueError("Undefined permission id", permission_id)
 
 def allPermissions(context):

Modified: Zope3/trunk/src/zope/app/security/tests/test_securitydirectives.py
===================================================================
--- Zope3/trunk/src/zope/app/security/tests/test_securitydirectives.py	2004-05-22 01:54:58 UTC (rev 24868)
+++ Zope3/trunk/src/zope/app/security/tests/test_securitydirectives.py	2004-05-22 01:56:25 UTC (rev 24869)
@@ -34,7 +34,7 @@
 
     def setUp(self):
         super(TestBase, self).setUp()
-        services = zapi.getServiceManager(None)
+        services = zapi.getGlobalServices()
 
         services.defineService(Authentication, IAuthenticationService)
         services.provideService(Authentication, principalRegistry)
@@ -62,7 +62,7 @@
 
     def testRegister(self):
         context = xmlconfig.file("perm.zcml", zope.app.security.tests)
-        perm = zapi.getUtility(None, IPermission, "Can.Do.It")
+        perm = zapi.getUtility(IPermission, "Can.Do.It")
         self.failUnless(perm.id.endswith('Can.Do.It'))
         self.assertEqual(perm.title, 'A Permissive Permission')
         self.assertEqual(perm.description,

Modified: Zope3/trunk/src/zope/app/securitypolicy/browser/principalpermissionview.py
===================================================================
--- Zope3/trunk/src/zope/app/securitypolicy/browser/principalpermissionview.py	2004-05-22 01:54:58 UTC (rev 24868)
+++ Zope3/trunk/src/zope/app/securitypolicy/browser/principalpermissionview.py	2004-05-22 01:56:25 UTC (rev 24869)
@@ -44,7 +44,7 @@
         ppm = IPrincipalPermissionManager(self.context)
 
         for perm_id in permission_ids:
-            permission = zapi.getUtility(self.context, IPermission, perm_id)
+            permission = zapi.getUtility(IPermission, perm_id)
             ppm.unsetPermissionForPrincipal(permission , principal)
 
         if REQUEST is not None:
@@ -57,7 +57,7 @@
         ppm = IPrincipalPermissionManager(self.context)
 
         for perm_id in permission_ids:
-            permission = zapi.getUtility(self.context, IPermission, perm_id)
+            permission = zapi.getUtility(IPermission, perm_id)
             ppm.grantPermissionToPrincipal(permission , principal)
         if REQUEST is not None:
             return self.index(message="Settings changed at %s"
@@ -69,7 +69,7 @@
         ppm = IPrincipalPermissionManager(self.context)
 
         for perm_id in permission_ids:
-            permission = zapi.getUtility(self.context, IPermission, perm_id)
+            permission = zapi.getUtility(IPermission, perm_id)
             ppm.denyPermissionToPrincipal(permission , principal)
         if REQUEST is not None:
             return self.index(message="Settings changed at %s"

Modified: Zope3/trunk/src/zope/app/securitypolicy/browser/rolepermissionview.py
===================================================================
--- Zope3/trunk/src/zope/app/securitypolicy/browser/rolepermissionview.py	2004-05-22 01:54:58 UTC (rev 24868)
+++ Zope3/trunk/src/zope/app/securitypolicy/browser/rolepermissionview.py	2004-05-22 01:56:25 UTC (rev 24869)
@@ -64,12 +64,12 @@
 
     def permissionForID(self, pid):
         roles = self.roles()
-        perm = zapi.getUtility(self.context, IPermission, pid)
+        perm = zapi.getUtility(IPermission, pid)
         return PermissionRoles(perm, self.context, roles)
 
     def roleForID(self, rid):
         permissions = self.permissions()
-        role = zapi.getUtility(self.context, IRole, name=rid)
+        role = zapi.getUtility(IRole, name=rid)
         return RolePermissions(role, self.context, permissions)
 
 

Modified: Zope3/trunk/src/zope/app/securitypolicy/browser/tests/test_principalpermissionview.py
===================================================================
--- Zope3/trunk/src/zope/app/securitypolicy/browser/tests/test_principalpermissionview.py	2004-05-22 01:54:58 UTC (rev 24868)
+++ Zope3/trunk/src/zope/app/securitypolicy/browser/tests/test_principalpermissionview.py	2004-05-22 01:56:25 UTC (rev 24869)
@@ -122,7 +122,7 @@
 
     def setUp(self):
         PlacefulSetup.setUp(self)
-        sm = zapi.getServiceManager(None)
+        sm = zapi.getGlobalServices()
         self._permissions = []
         self._permissions.append(DummyPermission('qux', 'Qux'))
         self._permissions.append(DummyPermission('baz', 'Baz'))

Modified: Zope3/trunk/src/zope/app/securitypolicy/browser/tests/test_principalroleview.py
===================================================================
--- Zope3/trunk/src/zope/app/securitypolicy/browser/tests/test_principalroleview.py	2004-05-22 01:54:58 UTC (rev 24868)
+++ Zope3/trunk/src/zope/app/securitypolicy/browser/tests/test_principalroleview.py	2004-05-22 01:56:25 UTC (rev 24869)
@@ -68,8 +68,8 @@
     def __init__(self, id, title):
         self.id = id
         self.title = title
-        
 
+
 def defineRole(id, title=None, description=None):
     role = Role(id, title, description)
     ztapi.provideUtility(IRole, role, name=role.id)
@@ -82,9 +82,9 @@
         PlacefulSetup.setUp(self)
 
         self._roles = [defineRole('qux', 'Qux'), defineRole('baz', 'Baz')]
-        
-        sm = zapi.getServiceManager(None)
 
+        sm = zapi.getGlobalServices()
+
         sm.defineService(Authentication, IAuthenticationService)
 
         self._principals = []

Modified: Zope3/trunk/src/zope/app/securitypolicy/tests/test_principalpermissionmanager.py
===================================================================
--- Zope3/trunk/src/zope/app/securitypolicy/tests/test_principalpermissionmanager.py	2004-05-22 01:54:58 UTC (rev 24868)
+++ Zope3/trunk/src/zope/app/securitypolicy/tests/test_principalpermissionmanager.py	2004-05-22 01:56:25 UTC (rev 24869)
@@ -41,7 +41,7 @@
 
     def setUp(self):
         super(Test, self).setUp()
-        services = zapi.getServiceManager(None)
+        services = zapi.getGlobalServices()
 
         services.defineService(Authentication, IAuthenticationService)
         services.provideService(Authentication, principalRegistry)

Modified: Zope3/trunk/src/zope/app/securitypolicy/tests/test_principalrolemanager.py
===================================================================
--- Zope3/trunk/src/zope/app/securitypolicy/tests/test_principalrolemanager.py	2004-05-22 01:54:58 UTC (rev 24868)
+++ Zope3/trunk/src/zope/app/securitypolicy/tests/test_principalrolemanager.py	2004-05-22 01:56:25 UTC (rev 24869)
@@ -39,7 +39,7 @@
 
     def setUp(self):
         super(Test, self).setUp()
-        services = zapi.getServiceManager(None)
+        services = zapi.getGlobalServices()
 
         services.defineService(Authentication, IAuthenticationService)
         services.provideService(Authentication, principalRegistry)

Modified: Zope3/trunk/src/zope/app/securitypolicy/tests/test_securitydirectives.py
===================================================================
--- Zope3/trunk/src/zope/app/securitypolicy/tests/test_securitydirectives.py	2004-05-22 01:54:58 UTC (rev 24868)
+++ Zope3/trunk/src/zope/app/securitypolicy/tests/test_securitydirectives.py	2004-05-22 01:56:25 UTC (rev 24869)
@@ -52,8 +52,8 @@
 
     def setUp(self):
         super(TestBase, self).setUp()
-        services = zapi.getServiceManager(None)
-    
+        services = zapi.getGlobalServices()
+
         services.defineService(Authentication, IAuthenticationService)
         services.provideService(Authentication, principalRegistry)
 
@@ -64,7 +64,7 @@
         context = xmlconfig.file("role.zcml",
                                  zope.app.securitypolicy.tests)
 
-        role = zapi.getUtility(None, IRole, name="zope.Everyperson")
+        role = zapi.getUtility(IRole, name="zope.Everyperson")
         self.failUnless(role.id.endswith('Everyperson'))
         self.assertEqual(role.title, 'Tout le monde')
         self.assertEqual(role.description,

Modified: Zope3/trunk/src/zope/app/securitypolicy/tests/test_zopepolicy.py
===================================================================
--- Zope3/trunk/src/zope/app/securitypolicy/tests/test_zopepolicy.py	2004-05-22 01:54:58 UTC (rev 24868)
+++ Zope3/trunk/src/zope/app/securitypolicy/tests/test_zopepolicy.py	2004-05-22 01:56:25 UTC (rev 24869)
@@ -79,7 +79,7 @@
 
     def setUp(self):
         PlacefulSetup.setUp(self)
-        services = zapi.getServiceManager(None)
+        services = zapi.getGlobalServices()
 
         services.defineService(Authentication, IAuthenticationService)
         services.provideService(Authentication, principalRegistry)

Modified: Zope3/trunk/src/zope/app/session/__init__.py
===================================================================
--- Zope3/trunk/src/zope/app/session/__init__.py	2004-05-22 01:54:58 UTC (rev 24868)
+++ Zope3/trunk/src/zope/app/session/__init__.py	2004-05-22 01:56:25 UTC (rev 24869)
@@ -192,7 +192,7 @@
                 data[product_id] = SessionData()
                 self.data = data[product_id]
 
-
+# XXX: remove context arg
 def getSession(context, request, product_id, session_data_container=None):
     ''' Retrieve an ISession. session_data_container defaults to 
         an ISessionDataContainer utility registered with the name product_id
@@ -202,15 +202,13 @@
             into a single object.
     '''
     if session_data_container is None:
-        dc = zapi.getUtility(context, ISessionDataContainer, product_id)
+        dc = zapi.getUtility(ISessionDataContainer, product_id)
     elif ISessionDataContainer.providedBy(session_data_container):
         dc = session_data_container
     else:
-        dc = zapi.getUtility(
-                context, ISessionDataContainer, session_data_container
-                )
+        dc = zapi.getUtility(ISessionDataContainer, session_data_container)
 
-    bim = zapi.getUtility(context, IBrowserIdManager)
+    bim = zapi.getUtility(IBrowserIdManager)
     browser_id = bim.getBrowserId(request)
     return Session(dc, browser_id, product_id)
 

Modified: Zope3/trunk/src/zope/app/session/tests.py
===================================================================
--- Zope3/trunk/src/zope/app/session/tests.py	2004-05-22 01:54:58 UTC (rev 24868)
+++ Zope3/trunk/src/zope/app/session/tests.py	2004-05-22 01:56:25 UTC (rev 24869)
@@ -215,7 +215,7 @@
 
     >>> root = setup.placefulSetUp(site=True)
     >>> setup.createStandardServices(root)
-    >>> sm = setup.createServiceManager(root)
+    >>> sm = setup.createServiceManager(root, True)
     >>> us = setup.addService(sm, Utilities, LocalUtilityService())
     >>> idmanager = CookieBrowserIdManager()
     >>> zope.interface.directlyProvides(idmanager,
@@ -232,8 +232,9 @@
    
     Make sure we can access utilities
 
-    >>> sdc = zapi.getUtility(root, ISessionDataContainer, 'persistent')
-    >>> bim = zapi.getUtility(root, IBrowserIdManager)
+    >>> sdc = zapi.getUtility(ISessionDataContainer, 'persistent',
+    ...                       context=root)
+    >>> bim = zapi.getUtility(IBrowserIdManager, context=root)
 
     Make sure getSession works
 

Modified: Zope3/trunk/src/zope/app/site/browser/__init__.py
===================================================================
--- Zope3/trunk/src/zope/app/site/browser/__init__.py	2004-05-22 01:54:58 UTC (rev 24868)
+++ Zope3/trunk/src/zope/app/site/browser/__init__.py	2004-05-22 01:56:25 UTC (rev 24869)
@@ -29,7 +29,7 @@
 from zope.app.publisher.browser import BrowserView
 from zope.app.site.interfaces import ISite, ISiteManager
 from zope.app.site.service import SiteManager
-from zope.app.component.nextservice import getNextServiceManager
+from zope.app.component.localservice import getLocalServices
 from zope.component.service import IGlobalServiceManager
 from zope.component.interfaces import IFactory
 from zope.interface.interfaces import IMethod
@@ -117,7 +117,7 @@
         content = super(ServiceAdding, self).add(content)
 
         # figure out the interfaces that this service implements
-        sm = zapi.getServiceManager(self.context)
+        sm = zapi.getServices(self.context)
         implements = []
         for type_name, interface in sm.getServiceDefinitions():
             if interface.providedBy(content):
@@ -169,7 +169,7 @@
     def listServiceTypes(self):
 
         # Collect all defined services interfaces that it implements.
-        sm = zapi.getServiceManager(self.context)
+        sm = zapi.getServices(self.context)
         lst = []
         for servicename, interface in sm.getServiceDefinitions():
             if interface.providedBy(self.context):
@@ -317,7 +317,7 @@
         # don't want the "change registration" link for parent services
         manageable = False
 
-    if IGlobalServiceManager.providedBy(sm):
+    if IGlobalServiceService.providedBy(sm):
         # global service manager
         names = []
         for type_name, interface in sm.getServiceDefinitions():
@@ -350,7 +350,7 @@
             'disabled': not url, 'manageable': manageable}
 
     # look for more
-    gatherConfiguredServices(getNextServiceManager(sm), request, items)
+    gatherConfiguredServices(getLocalService(sm), request, items)
 
     # make it a list and sort by name
     items = items.values()
@@ -366,12 +366,12 @@
     'type' determines which service is to be configured."""
 
     def isDisabled(self):
-        sm = zapi.getServiceManager(self.context)
+        sm = zapi.getServices(self.context)
         registry = sm.queryRegistrations(self.request.get('type'))
         return not (registry and registry.active())
 
     def listRegistry(self):
-        sm = zapi.getServiceManager(self.context)
+        sm = zapi.getServices(self.context)
         registry = sm.queryRegistrations(self.request.get('type'))
         if not registry:
             return []
@@ -405,7 +405,7 @@
         if not active:
             return ""
 
-        sm = zapi.getServiceManager(self.context)
+        sm = zapi.getServices(self.context)
         registry = sm.queryRegistrations(self.request.get('type'))
         if not registry:
             return _("Invalid service type specified")
@@ -449,7 +449,7 @@
 
         >>> from zope.publisher.browser import TestRequest
         >>> request = TestRequest()
-        
+
         Now we'll make our folder a site:
 
         >>> MakeSite(folder, request).addSiteManager()
@@ -609,7 +609,7 @@
         where the service dicts contains keys "name" and "registrations."
         registrations is a list of IRegistrations.
         """
-        sm = zapi.getServiceManager(self.context)
+        sm = zapi.getServices(self.context)
         for name, iface in sm.getServiceDefinitions():
             service = sm.queryService(name)
             if service is None:

Modified: Zope3/trunk/src/zope/app/site/browser/ftests/test_utilitytools.py
===================================================================
--- Zope3/trunk/src/zope/app/site/browser/ftests/test_utilitytools.py	2004-05-22 01:54:58 UTC (rev 24868)
+++ Zope3/trunk/src/zope/app/site/browser/ftests/test_utilitytools.py	2004-05-22 01:56:25 UTC (rev 24869)
@@ -103,7 +103,8 @@
                   'APPLY_RENAME': 'Rename'})
 
         root = self.getRootFolder()
-        util = zapi.queryUtility(root, ITranslationDomain, name='newzope')
+        util = zapi.queryUtility(ITranslationDomain, name='newzope',
+                                 context=root)
         self.assert_(util is not None)
 
     def testDeactivate(self):

Modified: Zope3/trunk/src/zope/app/site/browser/tools.py
===================================================================
--- Zope3/trunk/src/zope/app/site/browser/tools.py	2004-05-22 01:54:58 UTC (rev 24868)
+++ Zope3/trunk/src/zope/app/site/browser/tools.py	2004-05-22 01:56:25 UTC (rev 24869)
@@ -82,7 +82,7 @@
 
 class ToolsBacklink:
     def getLink(self):
-        service = zapi.getService(self.context, Services)
+        service = zapi.getService(Services)
         iface = zapi.queryType(self.context, IToolType)
         url = '%s/manage%sTool.html' %(zapi.getPath(service), iface.getName())
 

Modified: Zope3/trunk/src/zope/app/site/folder.py
===================================================================
--- Zope3/trunk/src/zope/app/site/folder.py	2004-05-22 01:54:58 UTC (rev 24868)
+++ Zope3/trunk/src/zope/app/site/folder.py	2004-05-22 01:56:25 UTC (rev 24869)
@@ -16,7 +16,6 @@
 $Id$
 """
 from zope.interface import implements
-from zope.app.component.nextservice import getNextServiceManager
 from zope.app.container.btree import BTreeContainer
 from zope.app.filerepresentation.interfaces import IDirectoryFactory
 from zope.app.registration.registration import RegisterableContainer

Modified: Zope3/trunk/src/zope/app/site/interfaces.py
===================================================================
--- Zope3/trunk/src/zope/app/site/interfaces.py	2004-05-22 01:54:58 UTC (rev 24868)
+++ Zope3/trunk/src/zope/app/site/interfaces.py	2004-05-22 01:56:25 UTC (rev 24869)
@@ -15,7 +15,7 @@
 
 $Id$
 """
-from zope.interface import Interface
+from zope.interface import Interface, Attribute
 import zope.schema
 from zope.component.interfaces import IServiceService
 from zope.app.container.interfaces import IContainer
@@ -124,7 +124,6 @@
         """Return a list of all registered registration names.
         """
 
-
     def queryActiveComponent(name, default=None):
         """Finds the registration registry for a given name, checks if it has
         an active registration, and if so, returns its component.  Otherwise
@@ -146,7 +145,9 @@
         its containing sites and its subsites.
         """
 
+    next = Attribute('The site that this site is a subsite of.')
 
+
 class IServiceRegistration(registration.IComponentRegistration):
     """Service Registration
 

Modified: Zope3/trunk/src/zope/app/site/service.py
===================================================================
--- Zope3/trunk/src/zope/app/site/service.py	2004-05-22 01:54:58 UTC (rev 24868)
+++ Zope3/trunk/src/zope/app/site/service.py	2004-05-22 01:56:25 UTC (rev 24869)
@@ -31,14 +31,13 @@
 
 import zope.interface
 from zope.component.exceptions import ComponentLookupError
-from zope.component import getServiceManager
 from zope.fssync.server.entryadapter import AttrMapping, DirectoryAdapter
 from zope.proxy import removeAllProxies
 
 import zope.app.registration.interfaces
 from zope.app import zapi
-from zope.app.component.nextservice import getNextService
-from zope.app.component.nextservice import getNextServiceManager
+from zope.app.component.localservice import getNextService
+from zope.app.component.localservice import getNextServices
 from zope.app.container.btree import BTreeContainer
 from zope.app.container.constraints import ItemTypePrecondition
 from zope.app.container.contained import Contained
@@ -92,7 +91,7 @@
         while True:
             if IContainmentRoot.providedBy(site):
                 # we're the root site, use the global sm
-                self.next = zapi.getServiceManager(None)
+                self.next = zapi.getGlobalServices()
                 return
             site = site.__parent__
             if site is None:
@@ -152,27 +151,28 @@
                 return registration.getComponent()
         return default
 
-    def getServiceDefinitions(wrapped_self):
+    def getServiceDefinitions(self):
         """See IServiceService
         """
         # Get the services defined here and above us, if any (as held
         # in a ServiceInterfaceService, presumably)
-        sm = getNextServiceManager(wrapped_self)
+        sm = self.next
         if sm is not None:
             serviceDefs = sm.getServiceDefinitions()
-        else: serviceDefs = {}
+        else:
+            serviceDefs = {}
 
         return serviceDefs
 
-    def queryService(wrapped_self, name, default=None):
+    def queryService(self, name, default=None):
         """See IServiceService
         """
         try:
-            return wrapped_self.getService(name)
+            return self.getService(name)
         except ComponentLookupError:
             return default
 
-    def getService(wrapped_self, name):
+    def getService(self, name):
         """See IServiceService
         """
 
@@ -180,26 +180,26 @@
         # the use of other services, like the adapter service.  We
         # need to be careful not to get into an infinate recursion by
         # getting out getService to be called while looking up
-        # services, so we'll
+        # services, so we'll use _v_calling to prevent recursive
+        # getService calls.
 
         if name == 'Services':
-            return wrapped_self # We are the service service
+            return self # We are the service service
 
-        if not getattr(wrapped_self, '_v_calling', 0):
+        if not getattr(self, '_v_calling', 0):
 
-            wrapped_self._v_calling = 1
+            self._v_calling = 1
             try:
-                service = wrapped_self.queryActiveComponent(name)
+                service = self.queryActiveComponent(name)
                 if service is not None:
                     return service
 
             finally:
-                wrapped_self._v_calling = 0
+                self._v_calling = 0
 
-        return getNextService(wrapped_self, name)
+        return getNextService(self, name)
 
-
-    def queryLocalService(wrapped_self, name, default=None):
+    def queryLocalService(self, name, default=None):
         """See ISiteManager
         """
 
@@ -211,25 +211,25 @@
         # getService calls.
 
         if name == 'Services':
-            return wrapped_self # We are the service service
+            return self # We are the service service
 
-        if not getattr(wrapped_self, '_v_calling', 0):
+        if not getattr(self, '_v_calling', 0):
 
-            wrapped_self._v_calling = 1
+            self._v_calling = 1
             try:
-                service = wrapped_self.queryActiveComponent(name)
+                service = self.queryActiveComponent(name)
                 if service is not None:
                     return service
 
             finally:
-                wrapped_self._v_calling = 0
+                self._v_calling = 0
 
         return default
 
-    def getInterfaceFor(wrapped_self, service_type):
+    def getInterfaceFor(self, service_type):
         """See IServiceService
         """
-        for type, interface in wrapped_self.getServiceDefinitions():
+        for type, interface in self.getServiceDefinitions():
             if type == service_type:
                 return interface
 
@@ -251,7 +251,7 @@
                               })
 
         if all:
-            next_service_manager = getNextServiceManager(self)
+            next_service_manager = self.next
             if IComponentManager.providedBy(next_service_manager):
                 next_service_manager.queryComponent(type, filter, all)
 
@@ -259,14 +259,13 @@
 
         return local
 
-    def findModule(wrapped_self, name):
+    def findModule(self, name):
         # override to pass call up to next service manager
-        mod = super(ServiceManager,
-                    removeAllProxies(wrapped_self)).findModule(name)
+        mod = super(ServiceManager, removeAllProxies(self)).findModule(name)
         if mod is not None:
             return mod
 
-        sm = getNextServiceManager(wrapped_self)
+        sm = self.next
         try:
             findModule = sm.findModule
         except AttributeError:
@@ -276,9 +275,8 @@
             return None
         return findModule(name)
 
-    def __import(wrapped_self, module_name):
-
-        mod = wrapped_self.findModule(module_name)
+    def __import(self, module_name):
+        mod = self.findModule(module_name)
         if mod is None:
             mod = sys.modules.get(module_name)
             if mod is None:
@@ -313,7 +311,7 @@
         # Else, this must be a hopeful test invocation
 
     def getInterface(self):
-        service_manager = getServiceManager(self)
+        service_manager = zapi.getServices(self)
         return service_manager.getInterfaceFor(self.name)
 
 

Modified: Zope3/trunk/src/zope/app/site/tests/test_servicemanager.py
===================================================================
--- Zope3/trunk/src/zope/app/site/tests/test_servicemanager.py	2004-05-22 01:54:58 UTC (rev 24868)
+++ Zope3/trunk/src/zope/app/site/tests/test_servicemanager.py	2004-05-22 01:56:25 UTC (rev 24869)
@@ -21,7 +21,7 @@
 from zope.app.tests import setup
 from zope.interface import Interface, implements
 from zope.app.site.service import ServiceManager, ServiceRegistration
-from zope.component import getService, getServiceManager
+from zope.component import getService, getServices, getGlobalServices
 from zope.app.site.tests.placefulsetup import PlacefulSetup
 from zope.app.traversing import traverse
 from zope.app.registration.interfaces import UnregisteredStatus
@@ -124,7 +124,7 @@
     def testUnbindService(self):
 
         root_ts = TestService()
-        gsm = getServiceManager(None)
+        gsm = getGlobalServices()
         gsm.provideService('test_service', root_ts)
 
         name = self.testGetService() # set up localservice
@@ -137,13 +137,13 @@
 
     def testContextServiceLookup(self):
         self.testGetService() # set up localservice
-        sm = getServiceManager(self.rootFolder)
+        sm = getServices(self.rootFolder)
         self.assertEqual(getService(self.folder1_1, 'test_service'),
                          sm['default']['test_service1'])
 
     def testContextServiceLookupWithMultipleServiceManagers(self):
         self.testGetService() # set up root localservice
-        sm=getServiceManager(self.rootFolder)
+        sm = getServices(self.rootFolder)
 
         sm2 = self.makeSite('folder1')
 
@@ -156,7 +156,7 @@
 
         ts = TestService()
 
-        globsm=getServiceManager(None)
+        globsm = getGlobalServices()
         globsm.provideService('test_service', ts)
 
         service = getService(self.folder1, 'test_service')
@@ -182,7 +182,7 @@
         manager.execute()
 
         self.folder1.setSiteManager(ServiceManager(self.folder1))
-        sm2=getServiceManager(self.folder1)
+        sm2 = getServices(self.folder1)
         default = contained(sm2['default'], self.folder1, name='default')
         default['m1'] = Manager('zope.app.services.tests.sample1',
                                 'x = "folder1 m1 1"')

Modified: Zope3/trunk/src/zope/app/site/tests/test_serviceregistration.py
===================================================================
--- Zope3/trunk/src/zope/app/site/tests/test_serviceregistration.py	2004-05-22 01:54:58 UTC (rev 24868)
+++ Zope3/trunk/src/zope/app/site/tests/test_serviceregistration.py	2004-05-22 01:56:25 UTC (rev 24869)
@@ -20,7 +20,6 @@
 
 from zope.interface import Interface, implements
 
-from zope.component import getServiceManager
 from zope.app.traversing import traverse, getPath
 from zope.app.site.service import ServiceRegistration
 from zope.app.site.tests.placefulsetup import PlacefulSetup

Modified: Zope3/trunk/src/zope/app/sqlscript/sqlscript.py
===================================================================
--- Zope3/trunk/src/zope/app/sqlscript/sqlscript.py	2004-05-22 01:54:58 UTC (rev 24868)
+++ Zope3/trunk/src/zope/app/sqlscript/sqlscript.py	2004-05-22 01:56:25 UTC (rev 24869)
@@ -103,7 +103,7 @@
 
     def getConnection(self):
         name = self.connectionName
-        connection = zapi.getUtility(self, IZopeDatabaseAdapter, name)
+        connection = zapi.getUtility(IZopeDatabaseAdapter, name)
         return connection()
 
     def __call__(self, **kw):

Modified: Zope3/trunk/src/zope/app/sqlscript/tests/test_sqlscript.py
===================================================================
--- Zope3/trunk/src/zope/app/sqlscript/tests/test_sqlscript.py	2004-05-22 01:54:58 UTC (rev 24868)
+++ Zope3/trunk/src/zope/app/sqlscript/tests/test_sqlscript.py	2004-05-22 01:56:25 UTC (rev 24869)
@@ -24,7 +24,7 @@
 from zope.app.rdb.interfaces import IZopeConnection
 from zope.app.rdb.interfaces import IZopeCursor
 from zope.app.servicenames import Adapters
-from zope.app.component import nextservice
+from zope.app.component import localservice
 from zope.app.tests.placelesssetup import PlacelessSetup
 
 from zope.app.annotation.interfaces import IAnnotatable, IAnnotations
@@ -41,7 +41,7 @@
 
 
 # Make spme fixes, so that we overcome some of the natural ZODB properties
-def getNextServiceManager(context):
+def getLocalServices(context):
     return sm
 
 class CursorStub:
@@ -141,8 +141,8 @@
 
     def tearDown(self):
         pass
-        
-        #nextservice.getNextServiceManager = self._old_getNextServiceManager
+        # XXX Why?
+        ##localservice.getLocalServices = self._old_getLocalServices
 
     def _getScript(self):
         return SQLScript("my_connection",

Modified: Zope3/trunk/src/zope/app/tests/setup.py
===================================================================
--- Zope3/trunk/src/zope/app/tests/setup.py	2004-05-22 01:54:58 UTC (rev 24868)
+++ Zope3/trunk/src/zope/app/tests/setup.py	2004-05-22 01:56:25 UTC (rev 24869)
@@ -79,28 +79,37 @@
     ztapi.provideAdapter(IAttributeRegisterable, IRegistered,
                          Registered)
 
+#------------------------------------------------------------------------
+# Service service lookup
+from zope.app.component.localservice import serviceServiceAdapter
+from zope.component.interfaces import IServiceService
+from zope.interface import Interface
+def setUpServiceService():
+    ztapi.provideAdapter(Interface, IServiceService, serviceServiceAdapter)
 
 #------------------------------------------------------------------------
 # Placeful setup
-from zope.app.component.hooks import getServiceManager_hook
+from zope.app.component.hooks import getServices_hook
 from zope.app.tests.placelesssetup import setUp as placelessSetUp
 from zope.app.tests.placelesssetup import tearDown as placelessTearDown
 def placefulSetUp(site=False):
     placelessSetUp()
-    zope.component.getServiceManager.sethook(getServiceManager_hook)
+    zope.component.getServices.sethook(getServices_hook)
     setUpAnnotations()
     setUpDependable()
     setUpTraversal()
     setUpRegistered()
+    setUpServiceService()
 
     if site:
         site = rootFolder()
-        createServiceManager(site)
+        createServiceManager(site, setsite=True)
         return site
 
 def placefulTearDown():
     placelessTearDown()
-    zope.component.getServiceManager.reset()
+    zope.component.getServices.reset()
+    thread_globals().site = None
 
 
 from zope.app.folder import Folder, rootFolder
@@ -132,10 +141,12 @@
 
 from zope.app.site.service import ServiceManager
 from zope.app.site.interfaces import ISite
-def createServiceManager(folder):
+from zope.thread import thread_globals
+def createServiceManager(folder, setsite=False):
     if not ISite.providedBy(folder):
         folder.setSiteManager(ServiceManager(folder))
-
+    if setsite:
+        thread_globals().site = folder
     return zapi.traverse(folder, "++etc++site")
 
 from zope.app.site.service import ServiceRegistration
@@ -170,7 +181,6 @@
     zapi.traverse(default.getRegistrationManager(), key).status = ActiveStatus
     return zapi.traverse(servicemanager, path)
 
-from zope.component import getServiceManager
 from zope.app.hub.interfaces import IObjectHub
 from zope.app.event.interfaces import ISubscriptionService
 from zope.app.event.localservice import EventService
@@ -184,7 +194,7 @@
     Well, uh, 3
     '''
     sm = createServiceManager(folder)
-    defineService = getServiceManager(None).defineService
+    defineService = zapi.getGlobalServices().defineService
 
     defineService(EventSubscription, ISubscriptionService)
 

Modified: Zope3/trunk/src/zope/app/tests/ztapi.py
===================================================================
--- Zope3/trunk/src/zope/app/tests/ztapi.py	2004-05-22 01:54:58 UTC (rev 24868)
+++ Zope3/trunk/src/zope/app/tests/ztapi.py	2004-05-22 01:56:25 UTC (rev 24869)
@@ -22,7 +22,7 @@
 from zope.app.traversing.interfaces import ITraversable
 
 def provideView(for_, type, providing, name, factory, layer="default"):
-    s = zapi.getService(None, Presentation)
+    s = zapi.getGlobalServices().getService(Presentation)
     return s.provideView(for_, name, type, factory, layer,
                          providing=providing)
     
@@ -33,7 +33,7 @@
     """
     if isinstance(factory, (list, tuple)):
         raise ValueError("Factory cannot be a list or tuple")
-    s = zapi.getService(None, Presentation)
+    s = zapi.getGlobalServices().getService(Presentation)
     return s.provideView(for_, name, IBrowserRequest, factory, layer,
                          providing=providing)
 
@@ -49,37 +49,37 @@
     """
     if isinstance(factory, (list, tuple)):
         raise ValueError("Factory cannot be a list or tuple")
-    s = zapi.getService(None, Presentation)
+    s = zapi.getGlobalServices().getService(Presentation)
     return s.provideResource(name, IBrowserRequest, factory, layer,
                              providing=providing)
 
 def setDefaultViewName(for_, name, layer='default'):
-    s = zapi.getService(None, Presentation)
+    s = zapi.getGlobalServices().getService(Presentation)
     s.setDefaultViewName(for_, IBrowserRequest, name, layer=layer)
 
 stypes = list, tuple
 def provideAdapter(required, provided, factory, name='', with=()):
     if isinstance(factory, (list, tuple)):
         raise ValueError("Factory cannot be a list or tuple")
-    s = zapi.getService(None, Adapters)
+    s = zapi.getGlobalServices().getService(Adapters)
 
     if with:
         required = (required, ) + tuple(with)
     elif not isinstance(required, stypes):
         required = [required]
-            
+
     s.register(required, provided, name, factory)
 
 def subscribe(required, provided, factory):
-    s = zapi.getService(None, Adapters)
+    s = zapi.getGlobalServices().getService(Adapters)
     s.subscribe(required, provided, factory)
-    
+
 def provideUtility(provided, component, name=''):
-    s = zapi.getService(None, Utilities)
+    s = zapi.getGlobalServices().getService(Utilities)
     s.provideUtility(provided, component, name)
-    
+
 def unprovideUtility(provided, name=''):
-    s = zapi.getService(None, Utilities)
+    s = zapi.getGlobalServices().getService(Utilities)
     s.register((), provided, name, None)
 
 def provideNamespaceHandler(name, handler):

Modified: Zope3/trunk/src/zope/app/tree/browser/__init__.py
===================================================================
--- Zope3/trunk/src/zope/app/tree/browser/__init__.py	2004-05-22 01:54:58 UTC (rev 24868)
+++ Zope3/trunk/src/zope/app/tree/browser/__init__.py	2004-05-22 01:56:25 UTC (rev 24869)
@@ -31,7 +31,7 @@
             root = self.context
         expanded_nodes = []
         if tree_state is not None:
-            encoder = zapi.getUtility(root, ITreeStateEncoder)
+            encoder = zapi.getUtility(ITreeStateEncoder)
             expanded_nodes = encoder.decodeTreeState(tree_state)
         node = Node(root, expanded_nodes, filter)
         node.expand()

Modified: Zope3/trunk/src/zope/app/tree/node.py
===================================================================
--- Zope3/trunk/src/zope/app/tree/node.py	2004-05-22 01:54:58 UTC (rev 24868)
+++ Zope3/trunk/src/zope/app/tree/node.py	2004-05-22 01:56:25 UTC (rev 24869)
@@ -116,7 +116,7 @@
         nodes = []
         if row_state is None:
             row_state = []
-        encoder = zapi.getUtility(self.context, ITreeStateEncoder)
+        encoder = zapi.getUtility(ITreeStateEncoder)
 
         if self.hasChildren() and len(row_state) > maxdepth:
             maxdepth = len(row_state)

Modified: Zope3/trunk/src/zope/app/undo/browser.py
===================================================================
--- Zope3/trunk/src/zope/app/undo/browser.py	2004-05-22 01:54:58 UTC (rev 24868)
+++ Zope3/trunk/src/zope/app/undo/browser.py	2004-05-22 01:56:25 UTC (rev 24869)
@@ -29,7 +29,7 @@
         transaction is an undo transaction.
         """
         request = self.request
-        undo = zapi.getUtility(self.context, IUndoManager)
+        undo = zapi.getUtility(IUndoManager)
         txn_info = undo.getPrincipalTransactions(request.principal, first=0,
                                                  last=1)
         if txn_info:
@@ -40,7 +40,7 @@
         """Undo the authenticated principal's last transaction and
         return where he/she came from"""
         request = self.request
-        undo = zapi.getUtility(self.context, IUndoManager)
+        undo = zapi.getUtility(IUndoManager)
         txn_info = undo.getPrincipalTransactions(request.principal, first=0,
                                                  last=1)
         if txn_info:
@@ -58,7 +58,7 @@
     def undoPrincipalTransactions(self, ids):
         """Undo transactions that were issued by the authenticated
         user specified in 'ids'."""
-        undo = zapi.getUtility(self.context, IUndoManager)
+        undo = zapi.getUtility(IUndoManager)
         undo.undoPrincipalTransactions(self.request.principal, ids)
         self._redirect()
 
@@ -70,13 +70,13 @@
         context = None
         if not showall:
             context = self.context
-        undo = zapi.getUtility(self.context, IUndoManager)
+        undo = zapi.getUtility(IUndoManager)
         return undo.getTransactions(context, first, last)
 
     def getPrincipalTransactions(self, first=0, last=-20, showall=False):
         context = None
         if not showall:
             context = self.context
-        undo = zapi.getUtility(self.context, IUndoManager)
+        undo = zapi.getUtility(IUndoManager)
         return undo.getPrincipalTransactions(self.request.principal, context,
                                              first, last)

Modified: Zope3/trunk/src/zope/app/utility/tests.py
===================================================================
--- Zope3/trunk/src/zope/app/utility/tests.py	2004-05-22 01:54:58 UTC (rev 24868)
+++ Zope3/trunk/src/zope/app/utility/tests.py	2004-05-22 01:56:25 UTC (rev 24869)
@@ -207,10 +207,10 @@
         setup.addUtility(sm2, 'u2', IFoo, Foo('u22'))
 
         # Make sure we acquire:
-        self.assertEqual(zapi.getUtility(sm2, IFoo, 'u1').name, 'u1')
+        self.assertEqual(zapi.getUtility(IFoo, 'u1', context=sm2).name, 'u1')
 
         # Make sure we override:
-        self.assertEqual(zapi.getUtility(sm2, IFoo, 'u2').name, 'u22')
+        self.assertEqual(zapi.getUtility(IFoo, 'u2', context=sm2).name, 'u22')
 
 
 def test_suite():

Modified: Zope3/trunk/src/zope/app/utility/utility.py
===================================================================
--- Zope3/trunk/src/zope/app/utility/utility.py	2004-05-22 01:54:58 UTC (rev 24868)
+++ Zope3/trunk/src/zope/app/utility/utility.py	2004-05-22 01:56:25 UTC (rev 24869)
@@ -49,7 +49,7 @@
         # This method is deprecated and is temporarily provided for
         # backward compatability
         from zope.app import zapi
-        from zope.app.component.nextservice import getNextService
+        from zope.app.component.localservice import getNextService
         next = getNextService(self, zapi.servicenames.Utilities)
         next_utils = dict(next.getUtilitiesFor(interface))
         for name, util in self.getUtilitiesFor(interface):

Modified: Zope3/trunk/src/zope/app/utility/vocabulary.py
===================================================================
--- Zope3/trunk/src/zope/app/utility/vocabulary.py	2004-05-22 01:54:58 UTC (rev 24868)
+++ Zope3/trunk/src/zope/app/utility/vocabulary.py	2004-05-22 01:56:25 UTC (rev 24869)
@@ -200,7 +200,7 @@
         if nameOnly is not False:
             nameOnly = True
         if isinstance(interface, (str, unicode)):
-            interface = zapi.getUtility(context, IInterface, interface)
+            interface = zapi.getUtility(IInterface, interface)
         utils = zapi.getUtilitiesFor(context, interface)
         self._terms = dict([(name, UtilityTerm(nameOnly and name or util, name))
                             for name, util in utils])

Modified: Zope3/trunk/src/zope/app/wiki/browser/wiki.py
===================================================================
--- Zope3/trunk/src/zope/app/wiki/browser/wiki.py	2004-05-22 01:54:58 UTC (rev 24868)
+++ Zope3/trunk/src/zope/app/wiki/browser/wiki.py	2004-05-22 01:56:25 UTC (rev 24869)
@@ -34,7 +34,7 @@
         content = super(AddWiki, self).createAndAdd(data)
         if self.request.get('textindex'):
             # Get the environment
-            sm = zapi.getServiceManager(content)
+            sm = zapi.getServices()
             pkg = sm['default']
             # Create, subscribe and add a Registration object.
             if 'WikiReg' not in pkg: 

Modified: Zope3/trunk/src/zope/app/wiki/browser/wikipage.py
===================================================================
--- Zope3/trunk/src/zope/app/wiki/browser/wikipage.py	2004-05-22 01:54:58 UTC (rev 24868)
+++ Zope3/trunk/src/zope/app/wiki/browser/wikipage.py	2004-05-22 01:56:25 UTC (rev 24869)
@@ -124,7 +124,7 @@
 
     def render(self):
         """Render the wiki page source."""
-        source = zapi.createObject(self, self.context.type, self.context.source)
+        source = zapi.createObject(None, self.context.type, self.context.source)
         view = zapi.getView(removeAllProxies(source), '', self.request)
         html = view.render()
         html = self.renderWikiLinks(html)
@@ -134,7 +134,7 @@
         result = []
         for name, comment in self.context.items():
             dc = DublinCoreViews(comment, self.request)
-            source = zapi.createObject(self, comment.type, comment.source)
+            source = zapi.createObject(None, comment.type, comment.source)
             view = zapi.getView(removeAllProxies(source), '', self.request)
             result.append({
                 'name': name,

Modified: Zope3/trunk/src/zope/app/wiki/wikipage.py
===================================================================
--- Zope3/trunk/src/zope/app/wiki/wikipage.py	2004-05-22 01:54:58 UTC (rev 24868)
+++ Zope3/trunk/src/zope/app/wiki/wikipage.py	2004-05-22 01:56:25 UTC (rev 24869)
@@ -260,8 +260,7 @@
         if not emails:
             return
         msg = 'Subject: %s\n\n\n%s' %(subject, body)
-        mail_delivery = zapi.getUtility(None,
-                                       IMailDelivery,
+        mail_delivery = zapi.getUtility(IMailDelivery,
                                        'wiki-delivery')
         mail_delivery.send('wiki at zope3.org' , emails, msg)
 

Modified: Zope3/trunk/src/zope/app/workflow/stateful/instance.py
===================================================================
--- Zope3/trunk/src/zope/app/workflow/stateful/instance.py	2004-05-22 01:54:58 UTC (rev 24868)
+++ Zope3/trunk/src/zope/app/workflow/stateful/instance.py	2004-05-22 01:56:25 UTC (rev 24869)
@@ -276,7 +276,7 @@
         if not script:
             return True
         if isinstance(script, (str, unicode)):
-            sm = zapi.getServiceManager(self)
+            sm = zapi.getServices(self)
             script = sm.resolve(script)
         return script(contexts)
 

Modified: Zope3/trunk/src/zope/app/workflow/stateful/tests/test_contentworkflow.py
===================================================================
--- Zope3/trunk/src/zope/app/workflow/stateful/tests/test_contentworkflow.py	2004-05-22 01:54:58 UTC (rev 24868)
+++ Zope3/trunk/src/zope/app/workflow/stateful/tests/test_contentworkflow.py	2004-05-22 01:56:25 UTC (rev 24869)
@@ -17,7 +17,6 @@
 """
 import unittest
 
-from zope.component import getServiceManager
 from zope.interface import Interface, implements
 from zope.interface.verify import verifyClass
 
@@ -90,7 +89,7 @@
 
     def setUp(self):
         WorkflowSetup.setUp(self)
-        sm = getServiceManager(None)
+        sm = zapi.getGlobalServices()
         sm.defineService(EventSubscription, ISubscriptionService)
         self.events = EventService()
         setup.addService(self.sm, EventSubscription, self.events)

Modified: Zope3/trunk/src/zope/app/workflow/stateful/tests/test_xmlimportexport.py
===================================================================
--- Zope3/trunk/src/zope/app/workflow/stateful/tests/test_xmlimportexport.py	2004-05-22 01:54:58 UTC (rev 24868)
+++ Zope3/trunk/src/zope/app/workflow/stateful/tests/test_xmlimportexport.py	2004-05-22 01:56:25 UTC (rev 24869)
@@ -132,7 +132,7 @@
 
         self.assertEqual(
             testpd.schemaPermissions['title'],
-            (CheckerPublic, zapi.getUtility(None, IPermission, 'zope.View')))
+            (CheckerPublic, zapi.getUtility(IPermission, 'zope.View')))
 
         self.assertEqual(len(testpd.states), 3)
         self.assertEqual(len(testpd.transitions), 3)

Modified: Zope3/trunk/src/zope/app/workflow/stateful/xmlimportexport.py
===================================================================
--- Zope3/trunk/src/zope/app/workflow/stateful/xmlimportexport.py	2004-05-22 01:54:58 UTC (rev 24868)
+++ Zope3/trunk/src/zope/app/workflow/stateful/xmlimportexport.py	2004-05-22 01:56:25 UTC (rev 24869)
@@ -95,7 +95,7 @@
         elif perm_id == '':
             perm = None
         else:
-            perm = zapi.getUtility(None, IPermission, perm_id)
+            perm = zapi.getUtility(IPermission, perm_id)
         if not fieldName in perms.keys():
             perms[fieldName] = (CheckerPublic, CheckerPublic)
         if type == u'get':

Modified: Zope3/trunk/src/zope/app/workflow/tests/workflowsetup.py
===================================================================
--- Zope3/trunk/src/zope/app/workflow/tests/workflowsetup.py	2004-05-22 01:54:58 UTC (rev 24868)
+++ Zope3/trunk/src/zope/app/workflow/tests/workflowsetup.py	2004-05-22 01:56:25 UTC (rev 24869)
@@ -31,7 +31,7 @@
 class WorkflowSetup(PlacefulSetup):
 
     def setUp(self):
-        self.root_sm = zapi.getServiceManager(None)
+        self.root_sm = zapi.getGlobalServices()
 
         self.sm = PlacefulSetup.setUp(self, site=True)
         setup.addService(self.sm, Utilities, LocalUtilityService())

Modified: Zope3/trunk/src/zope/i18n/__init__.py
===================================================================
--- Zope3/trunk/src/zope/i18n/__init__.py	2004-05-22 01:54:58 UTC (rev 24868)
+++ Zope3/trunk/src/zope/i18n/__init__.py	2004-05-22 01:56:25 UTC (rev 24869)
@@ -28,6 +28,7 @@
 _get_var_regex = re.compile(r'%(n)s' %({'n': NAME_RE}))
 
 
+# XXX: location not needed
 def translate(location, msgid, domain=None, mapping=None, context=None,
               target_language=None, default=None):
 
@@ -40,7 +41,7 @@
         default = msgid.default
         mapping = msgid.mapping
 
-    util = queryUtility(location, ITranslationDomain, name=domain)
+    util = queryUtility(ITranslationDomain, name=domain)
 
     if util is None:
         return interpolate(default, mapping)

Modified: Zope3/trunk/src/zope/i18n/simpletranslationdomain.py
===================================================================
--- Zope3/trunk/src/zope/i18n/simpletranslationdomain.py	2004-05-22 01:54:58 UTC (rev 24868)
+++ Zope3/trunk/src/zope/i18n/simpletranslationdomain.py	2004-05-22 01:56:25 UTC (rev 24869)
@@ -54,7 +54,7 @@
         if target_language is None and context is not None:
             langs = [m[0] for m in self.messages.keys()]
             # Let's negotiate the language to translate to. :)
-            negotiator = getUtility(self, INegotiator)
+            negotiator = getUtility(INegotiator)
             target_language = negotiator.getLanguage(langs, context)
 
         # Make a raw translation without interpolation

Modified: Zope3/trunk/src/zope/i18n/translationdomain.py
===================================================================
--- Zope3/trunk/src/zope/i18n/translationdomain.py	2004-05-22 01:54:58 UTC (rev 24868)
+++ Zope3/trunk/src/zope/i18n/translationdomain.py	2004-05-22 01:56:25 UTC (rev 24869)
@@ -78,7 +78,7 @@
         # MessageID attributes override arguments
         if isinstance(msgid, MessageID):
             if msgid.domain != self.domain:
-                util = getUtility(None, ITranslationDomain, msgid.domain)
+                util = getUtility(ITranslationDomain, msgid.domain)
                 return util.translate(msgid, mapping, context,
                                       target_language, default)
             else:




More information about the Zope3-Checkins mailing list