[Zope3-checkins] SVN: Zope3/trunk/src/z Cleanup of component API and its use. Specific changes to API:

Garrett Smith garrett at mojave-corp.com
Tue Jun 1 23:47:10 EDT 2004


Log message for revision 25169:
Cleanup of component API and its use. Specific changes to API:

- The 'name' and 'default' arguments in queryAdapter and queryUtility have beeen swapped -- the 'name' argument now precedes the 'default' argument.

- getNamedAdapter and queryNamedAdapter have been deleted. Use instead getAdapter and queryAdapter respectively, supplying the 'name' argument.

- queryService has been deleted. Use getService to obtain a service, which rauses ComponentLookupError is the service is not available.


-=-
Modified: Zope3/trunk/src/z3checkins/tests/test_message.py
===================================================================
--- Zope3/trunk/src/z3checkins/tests/test_message.py	2004-06-02 01:58:30 UTC (rev 25168)
+++ Zope3/trunk/src/z3checkins/tests/test_message.py	2004-06-02 03:47:07 UTC (rev 25169)
@@ -391,8 +391,7 @@
 
     def setUp(self):
         PlacelessSetup.setUp(self)
-        getService(None, 'Utilities').provideUtility(IMessageParser,
-                                                     ParserStub())
+        getService('Utilities').provideUtility(IMessageParser, ParserStub())
 
     def test_createAndAdd(self):
         from z3checkins.message import MessageUpload
@@ -488,7 +487,7 @@
     def setUp(self):
         PlacelessSetup.setUp(self)
         from z3checkins.message import MessageContainerAdapter
-        getService(None, servicenames.Adapters).register(
+        getService(servicenames.Adapters).register(
                 [None], IMessageArchive, "", MessageContainerAdapter)
 
     def test_checkins(self):
@@ -689,7 +688,7 @@
                         'c': MessageStub(date=3, log_message='yyy')}
         view.request = RequestStub()
         view.index = view
-        getService(None, servicenames.Presentation).provideView(
+        getService(servicenames.Presentation).provideView(
                 ICheckinMessage, 'html', IRequest, MessageTestView)
 
         res = view.renderCheckins()
@@ -707,9 +706,9 @@
         view.request = RequestStub()
         view.index = view
         view.bookmarks = lambda: [1]
-        getService(None, servicenames.Presentation).provideView(
+        getService(servicenames.Presentation).provideView(
                 ICheckinMessage, 'html', IRequest, MessageTestView)
-        getService(None, servicenames.Presentation).provideView(
+        getService(servicenames.Presentation).provideView(
                 IBookmark, 'html', IRequest, BookmarkTestView)
 
         res = view.renderCheckins()
@@ -747,7 +746,7 @@
     def setUp(self):
         PlacelessSetup.setUp(self)
         from z3checkins.message import MessageContainerAdapter
-        getService(None, servicenames.Adapters).register(
+        getService(servicenames.Adapters).register(
                 [None], IMessageArchive, "", MessageContainerAdapter)
 
     def test_body_strange(self):

Modified: Zope3/trunk/src/zope/app/apidoc/__init__.py
===================================================================
--- Zope3/trunk/src/zope/app/apidoc/__init__.py	2004-06-02 01:58:30 UTC (rev 25168)
+++ Zope3/trunk/src/zope/app/apidoc/__init__.py	2004-06-02 03:47:07 UTC (rev 25169)
@@ -53,8 +53,7 @@
     
     def get(self, key, default=None):
         """See zope.app.container.interfaces.IReadContainer"""
-        utility = zapi.queryUtility(IDocumentationModule, default, key,
-                                    context=self)
+        utility = zapi.queryUtility(IDocumentationModule, key, default, self)
         if utility != default:
             locate(utility, self, key)
         return utility

Modified: Zope3/trunk/src/zope/app/apidoc/viewmodule/browser.py
===================================================================
--- Zope3/trunk/src/zope/app/apidoc/viewmodule/browser.py	2004-06-02 01:58:30 UTC (rev 25168)
+++ Zope3/trunk/src/zope/app/apidoc/viewmodule/browser.py	2004-06-02 03:47:07 UTC (rev 25169)
@@ -208,7 +208,7 @@
 
         from zope.component.presentation import PresentationRegistration
         from zope.proxy import removeAllProxies
-        service = zapi.getService(self.context, 'Presentation')
+        service = zapi.getService('Presentation')
         # This is okay here, since we only read from the service. Once
         # registration objects have sensible security declarations, we can
         # remove that call. 

Modified: Zope3/trunk/src/zope/app/applicationcontrol/browser/servercontrol.py
===================================================================
--- Zope3/trunk/src/zope/app/applicationcontrol/browser/servercontrol.py	2004-06-02 01:58:30 UTC (rev 25168)
+++ Zope3/trunk/src/zope/app/applicationcontrol/browser/servercontrol.py	2004-06-02 03:47:07 UTC (rev 25169)
@@ -23,7 +23,7 @@
 class ServerControlView:
 
     def serverControl(self):
-        return zapi.getUtility(IServerControl, context=self.context)
+        return zapi.getUtility(IServerControl)
 
     def action(self, time=0):
         """Do the shutdown/restart!"""

Modified: Zope3/trunk/src/zope/app/applicationcontrol/browser/tests/test_servercontrolview.py
===================================================================
--- Zope3/trunk/src/zope/app/applicationcontrol/browser/tests/test_servercontrolview.py	2004-06-02 01:58:30 UTC (rev 25168)
+++ Zope3/trunk/src/zope/app/applicationcontrol/browser/tests/test_servercontrolview.py	2004-06-02 03:47:07 UTC (rev 25169)
@@ -24,7 +24,6 @@
 from zope.app.applicationcontrol.interfaces import IServerControl
 from zope.app.servicenames import Utilities
 from zope.app.site.tests.placefulsetup import PlacefulSetup
-from zope.component import getService
 
 class ServerControlStub(object):
     implements(IServerControl)

Modified: Zope3/trunk/src/zope/app/applicationcontrol/runtimeinfo.py
===================================================================
--- Zope3/trunk/src/zope/app/applicationcontrol/runtimeinfo.py	2004-06-02 01:58:30 UTC (rev 25168)
+++ Zope3/trunk/src/zope/app/applicationcontrol/runtimeinfo.py	2004-06-02 03:47:07 UTC (rev 25169)
@@ -53,7 +53,7 @@
     def getZopeVersion(self):
         """See zope.app.applicationcontrol.interfaces.IRuntimeInfo"""
         try:
-            version_utility = getUtility(IZopeVersion, context=self.context)
+            version_utility = getUtility(IZopeVersion)
         except ComponentLookupError:
             return ""
         return version_utility.getZopeVersion()

Modified: Zope3/trunk/src/zope/app/applicationcontrol/tests/test_runtimeinfo.py
===================================================================
--- Zope3/trunk/src/zope/app/applicationcontrol/tests/test_runtimeinfo.py	2004-06-02 01:58:30 UTC (rev 25168)
+++ Zope3/trunk/src/zope/app/applicationcontrol/tests/test_runtimeinfo.py	2004-06-02 03:47:07 UTC (rev 25169)
@@ -80,7 +80,7 @@
         # we expect that there is no utility
         self.assertEqual(runtime_info.getZopeVersion(), "")
 
-        getService(None,'Utilities').provideUtility(IZopeVersion,
+        getService('Utilities').provideUtility(IZopeVersion,
                                                TestZopeVersion())
         self.assertEqual(runtime_info.getZopeVersion(),
                                          stupid_version_string)

Modified: Zope3/trunk/src/zope/app/appsetup/bootstrap.py
===================================================================
--- Zope3/trunk/src/zope/app/appsetup/bootstrap.py	2004-06-02 01:58:30 UTC (rev 25168)
+++ Zope3/trunk/src/zope/app/appsetup/bootstrap.py	2004-06-02 03:47:07 UTC (rev 25169)
@@ -126,10 +126,8 @@
         
         Returns the name added or None if nothing was added.
         """
-        utility_manager = zapi.getService(
-                self.root_folder, Utilities
-                )
-        utility = utility_manager.queryUtility(interface, name=name)
+        utility_manager = zapi.getService(Utilities, self.root_folder)
+        utility = utility_manager.queryUtility(interface, name)
         if utility is None:
             return addConfigureUtility(
                     self.root_folder, interface, utility_type, utility_factory,

Modified: Zope3/trunk/src/zope/app/bundle/browser/__init__.py
===================================================================
--- Zope3/trunk/src/zope/app/bundle/browser/__init__.py	2004-06-02 01:58:30 UTC (rev 25168)
+++ Zope3/trunk/src/zope/app/bundle/browser/__init__.py	2004-06-02 03:47:07 UTC (rev 25169)
@@ -151,7 +151,7 @@
 
     def getServiceStatus(self, name):
         try:
-            svc = zapi.getService(self.context, name)
+            svc = zapi.getService(name)
         except:
             svc = None
         path = ""

Modified: Zope3/trunk/src/zope/app/component/hooks.py
===================================================================
--- Zope3/trunk/src/zope/app/component/hooks.py	2004-06-02 01:58:30 UTC (rev 25168)
+++ Zope3/trunk/src/zope/app/component/hooks.py	2004-06-02 03:47:07 UTC (rev 25169)
@@ -17,7 +17,7 @@
 """
 
 import warnings
-from zope.component import getService, getAdapter, queryAdapter
+from zope.component import getService, getAdapter
 from zope.component.interfaces import IServiceService
 from zope.app.site.interfaces import ISite
 from zope.component.service import serviceManager
@@ -76,7 +76,7 @@
     # XXX test
     #if context is None:
     #    context = object
-    views = getService(context, Presentation)
+    views = getService(Presentation, context)
     view = views.queryView(object, name, request, default=default,
                            providing=providing)
     if ILocation.providedBy(view):

Modified: Zope3/trunk/src/zope/app/component/interface.py
===================================================================
--- Zope3/trunk/src/zope/app/component/interface.py	2004-06-02 01:58:30 UTC (rev 25168)
+++ Zope3/trunk/src/zope/app/component/interface.py	2004-06-02 03:47:07 UTC (rev 25169)
@@ -17,7 +17,6 @@
 __metaclass__ = type
 
 from zope.component.exceptions import ComponentLookupError
-from zope.component import getService
 from zope.interface import directlyProvides
 from zope.interface.interfaces import IInterface
 from types import ClassType
@@ -145,7 +144,7 @@
     
     """
     
-    return zapi.queryUtility(IInterface, default, id)
+    return zapi.queryUtility(IInterface, id, default)
 
 def searchInterface(context, search_string=None, base=None):
     """Interfaces search

Modified: Zope3/trunk/src/zope/app/component/localservice.py
===================================================================
--- Zope3/trunk/src/zope/app/component/localservice.py	2004-06-02 01:58:30 UTC (rev 25168)
+++ Zope3/trunk/src/zope/app/component/localservice.py	2004-06-02 03:47:07 UTC (rev 25169)
@@ -46,10 +46,9 @@
 #
 # getNextService(context, name):
 # # Returns the next service manager's service with that name.
-#
-# plus queryXXX versions.
 
 
+
 ##def getLocalService(context, name):
 ##    service = queryLocalService(context, name)
 ##    if service is None:
@@ -59,9 +58,9 @@
 ##def queryLocalService(context, name, default=None):
 ##    try:
 ##        sm = getLocalServices(context)
+##        return sm.getService(name)
 ##    except ComponentLookupError:
 ##        return default
-##    return sm.queryService(name, default)
 
 def queryNextService(context, name, default=None):
     try:
@@ -72,10 +71,7 @@
 def getNextService(context, name):
     """Returns the service with the given name from the next service manager.
     """
-    service = getNextServices(context).queryService(name)
-    if service is None:
-        raise ComponentLookupError(name)
-    return service
+    return getNextServices(context).getService(name)
 
 def getNextServices(context):
     """Returns the next service manager to the one that contains 'context'.

Modified: Zope3/trunk/src/zope/app/component/tests/test_contentdirective.py
===================================================================
--- Zope3/trunk/src/zope/app/component/tests/test_contentdirective.py	2004-06-02 01:58:30 UTC (rev 25168)
+++ Zope3/trunk/src/zope/app/component/tests/test_contentdirective.py	2004-06-02 03:47:07 UTC (rev 25169)
@@ -174,8 +174,8 @@
 </content>
                        """)
         xmlconfig(f)
-        self.assertRaises(ComponentLookupError, zapi.getUtility,
-                          None, IFactory, 'Example')
+        self.assertRaises(ComponentLookupError, zapi.getUtility, IFactory, 
+                          'Example')
         factory = zapi.getUtility(
             IFactory, 'zope.app.component.tests.exampleclass.ExampleClass')
         self.assertEquals(factory.title, "Example content")

Modified: Zope3/trunk/src/zope/app/component/tests/test_directives.py
===================================================================
--- Zope3/trunk/src/zope/app/component/tests/test_directives.py	2004-06-02 01:58:30 UTC (rev 25168)
+++ Zope3/trunk/src/zope/app/component/tests/test_directives.py	2004-06-02 03:47:07 UTC (rev 25169)
@@ -326,8 +326,7 @@
 
         self.testAdapter()
         self.assertEqual(IApp(Content()).__class__, Comp)
-        self.assertEqual(zapi.queryNamedAdapter(Content(), IV, 'test'),
-                         None)
+        self.assertEqual(zapi.queryAdapter(Content(), IV, 'test'), None)
 
         xmlconfig(StringIO(template % (
             """
@@ -341,8 +340,7 @@
             )))
 
         self.assertEqual(
-            zapi.getNamedAdapter(Content(), IApp, "test").__class__,
-            Comp)
+            zapi.getAdapter(Content(), IApp, "test").__class__, Comp)
 
     def testProtectedAdapter(self):
 
@@ -385,7 +383,7 @@
         # Full import is critical!
         from zope.component.tests.components import IApp, comp
 
-        self.assertEqual(zapi.queryUtility(IV, None), None)
+        self.assertEqual(zapi.queryUtility(IV), None)
 
         xmlconfig(StringIO(template % (
             """
@@ -405,7 +403,7 @@
 
         self.testUtility()
 
-        self.assertEqual(zapi.queryUtility(IV, None, name='test'), None)
+        self.assertEqual(zapi.queryUtility(IV, 'test'), None)
 
         xmlconfig(StringIO(template % (
             """
@@ -424,7 +422,7 @@
         # Full import is critical!
         from zope.component.tests.components import IApp, Comp
 
-        self.assertEqual(zapi.queryUtility(IV, None), None)
+        self.assertEqual(zapi.queryUtility(IV), None)
 
         xmlconfig(StringIO(template % (
             """
@@ -442,7 +440,7 @@
         # Full import is critical!
         from zope.component.tests.components import IApp, comp
 
-        self.assertEqual(zapi.queryUtility(IV, None), None)
+        self.assertEqual(zapi.queryUtility(IV), None)
 
         xmlconfig(StringIO(template % (
             """

Modified: Zope3/trunk/src/zope/app/component/tests/test_localservice.py
===================================================================
--- Zope3/trunk/src/zope/app/component/tests/test_localservice.py	2004-06-02 01:58:30 UTC (rev 25168)
+++ Zope3/trunk/src/zope/app/component/tests/test_localservice.py	2004-06-02 03:47:07 UTC (rev 25169)
@@ -36,11 +36,10 @@
     def __init__(self):
         self.dummy_service = object()
 
-    def queryService(self, name, default=None):
+    def getService(self, name):
         if name == 'dummy':
             return self.dummy_service
-        else:
-            return default
+        raise ComponentLookupError(name)
 
 class Folder:
     implements(IPossibleSite)

Modified: Zope3/trunk/src/zope/app/component/tests/test_servicedirective.py
===================================================================
--- Zope3/trunk/src/zope/app/component/tests/test_servicedirective.py	2004-06-02 01:58:30 UTC (rev 25168)
+++ Zope3/trunk/src/zope/app/component/tests/test_servicedirective.py	2004-06-02 03:47:07 UTC (rev 25169)
@@ -92,7 +92,7 @@
             )))
 
     def testServiceConfig(self):
-        self.assertRaises(ComponentLookupError, getService, None, "Foo")
+        self.assertRaises(ComponentLookupError, getService, "Foo")
 
         xmlconfig(StringIO(template % (
             """
@@ -108,13 +108,13 @@
             """
             )))
 
-        service = getService(None, "Foo")
+        service = getService("Foo")
         self.assertEqual(service.foo(), "foo here")
         self.assertEqual(service.foobar(), "foobarred")
         self.assertEqual(service.bar(), "you shouldn't get this")
 
     def testServiceFactoryConfig(self):
-        self.assertRaises(ComponentLookupError, getService, None, "Foo")
+        self.assertRaises(ComponentLookupError, getService, "Foo")
 
         xmlconfig(StringIO(template % (
             """
@@ -130,13 +130,13 @@
             """
             )))
 
-        service = getService(None, "Foo")
+        service = getService("Foo")
         self.assertEqual(service.foo(), "foo here")
         self.assertEqual(service.foobar(), "foobarred")
         self.assertEqual(service.bar(), "you shouldn't get this")
 
     def testPublicProtectedServiceConfig(self):
-        self.assertRaises(ComponentLookupError, getService, None, "Foo")
+        self.assertRaises(ComponentLookupError, getService, "Foo")
 
         xmlconfig(StringIO(template % (
             """
@@ -153,14 +153,14 @@
             """
             )))
 
-        service = getService(None, "Foo")
+        service = getService("Foo")
         service = ProxyFactory(service) # simulate untrusted code!
         self.assertEqual(service.foo(), "foo here")
         self.assertEqual(service.foobar(), "foobarred")
         self.assertRaises(Forbidden, getattr, service, 'bar')
 
     def testProtectedServiceConfig(self):
-        self.assertRaises(ComponentLookupError, getService, None, "Foo")
+        self.assertRaises(ComponentLookupError, getService, "Foo")
 
         xmlconfig(StringIO(template % (
             """
@@ -191,7 +191,7 @@
         from zope.security.management import newInteraction
         newInteraction(ParticipationStub('someuser'))
 
-        service = getService(None, "Foo")
+        service = getService("Foo")
         service = ProxyFactory(service) # simulate untrusted code!
 
         self.assertRaises(Unauthorized, getattr, service, 'foo')

Modified: Zope3/trunk/src/zope/app/container/browser/adding.py
===================================================================
--- Zope3/trunk/src/zope/app/container/browser/adding.py	2004-06-02 01:58:30 UTC (rev 25168)
+++ Zope3/trunk/src/zope/app/container/browser/adding.py	2004-06-02 03:47:07 UTC (rev 25169)
@@ -106,7 +106,7 @@
         if view is not None:
             return view
 
-        factory = zapi.queryUtility(IFactory, name=name)
+        factory = zapi.queryUtility(IFactory, name)
         if factory is None:
             return super(BasicAdding, self).publishTraverse(request, name)
 

Modified: Zope3/trunk/src/zope/app/container/browser/contents.py
===================================================================
--- Zope3/trunk/src/zope/app/container/browser/contents.py	2004-06-02 01:58:30 UTC (rev 25168)
+++ Zope3/trunk/src/zope/app/container/browser/contents.py	2004-06-02 03:47:07 UTC (rev 25169)
@@ -247,7 +247,7 @@
         container_path = zapi.getPath(self.context)
 
         user = self.request.principal
-        annotationsvc = zapi.getService(self.context, 'PrincipalAnnotation')
+        annotationsvc = zapi.getService('PrincipalAnnotation')
         annotations = annotationsvc.getAnnotations(user)
         clipboard = IPrincipalClipboard(annotations)
         clipboard.clearContents()
@@ -267,7 +267,7 @@
         container_path = zapi.getPath(self.context)
 
         user = self.request.principal
-        annotationsvc = zapi.getService(self.context, 'PrincipalAnnotation')
+        annotationsvc = zapi.getService('PrincipalAnnotation')
         annotations = annotationsvc.getAnnotations(user)
         clipboard = IPrincipalClipboard(annotations)
         clipboard.clearContents()
@@ -282,7 +282,7 @@
         """
         target = self.context
         user = self.request.principal
-        annotationsvc = zapi.getService(self.context, 'PrincipalAnnotation')
+        annotationsvc = zapi.getService('PrincipalAnnotation')
         annotations = annotationsvc.getAnnotations(user)
         clipboard = IPrincipalClipboard(annotations)
         items = clipboard.getContents()
@@ -311,7 +311,7 @@
         """
         target = self.context
         user = self.request.principal
-        annotationsvc = zapi.getService(self.context, 'PrincipalAnnotation')
+        annotationsvc = zapi.getService('PrincipalAnnotation')
         annotations = annotationsvc.getAnnotations(user)
         clipboard = IPrincipalClipboard(annotations)
         items = clipboard.getContents()
@@ -346,7 +346,7 @@
 
         user = self.request.principal
 
-        annotationsvc = zapi.getService(self.context, 'PrincipalAnnotation')
+        annotationsvc = zapi.getService('PrincipalAnnotation')
         annotations = annotationsvc.getAnnotations(user)
 
         # touch at least one item to in clipboard confirm contents

Modified: Zope3/trunk/src/zope/app/container/browser/tests/test_contents.py
===================================================================
--- Zope3/trunk/src/zope/app/container/browser/tests/test_contents.py	2004-06-02 01:58:30 UTC (rev 25168)
+++ Zope3/trunk/src/zope/app/container/browser/tests/test_contents.py	2004-06-02 03:47:07 UTC (rev 25169)
@@ -31,7 +31,7 @@
 
 from zope.app.copypastemove.interfaces import IPrincipalClipboard
 from zope.app.copypastemove import PrincipalClipboard
-from zope.component import getServices, getGlobalServices
+from zope.component import getGlobalServices
 from zope.app.principalannotation import PrincipalAnnotationService
 from zope.app.principalannotation.interfaces import IPrincipalAnnotationService
 from zope.app.annotation.interfaces import IAnnotations

Modified: Zope3/trunk/src/zope/app/copypastemove/tests/test_clipboard.py
===================================================================
--- Zope3/trunk/src/zope/app/copypastemove/tests/test_clipboard.py	2004-06-02 01:58:30 UTC (rev 25168)
+++ Zope3/trunk/src/zope/app/copypastemove/tests/test_clipboard.py	2004-06-02 03:47:07 UTC (rev 25169)
@@ -45,7 +45,7 @@
     def testAddItems(self):
         user = self._auth['one']['srichter']
 
-        annotationsvc = zapi.getService(self, 'PrincipalAnnotation')
+        annotationsvc = zapi.getService('PrincipalAnnotation', self)
         annotations = annotationsvc.getAnnotations(user)
         clipboard = IPrincipalClipboard(annotations)
         clipboard.addItems('move', ['bla', 'bla/foo', 'bla/bar'])
@@ -61,7 +61,7 @@
     def testSetContents(self):
         user = self._auth['one']['srichter']
 
-        annotationsvc = zapi.getService(self, 'PrincipalAnnotation')
+        annotationsvc = zapi.getService('PrincipalAnnotation', self)
         annotations = annotationsvc.getAnnotations(user)
         clipboard = IPrincipalClipboard(annotations)
 
@@ -77,7 +77,7 @@
     def testClearContents(self):
         user = self._auth['one']['srichter']
 
-        annotationsvc = zapi.getService(self, 'PrincipalAnnotation')
+        annotationsvc = zapi.getService('PrincipalAnnotation', self)
         annotations = annotationsvc.getAnnotations(user)
         clipboard = IPrincipalClipboard(annotations)
         clipboard.clearContents()

Modified: Zope3/trunk/src/zope/app/dav/propfind.py
===================================================================
--- Zope3/trunk/src/zope/app/dav/propfind.py	2004-06-02 01:58:30 UTC (rev 25168)
+++ Zope3/trunk/src/zope/app/dav/propfind.py	2004-06-02 03:47:07 UTC (rev 25169)
@@ -198,7 +198,7 @@
                   if e.nodeType == e.ELEMENT_NODE]
         for node in childs:
             ns = node.namespaceURI
-            iface = zapi.queryUtility(IDAVNamespace, None, ns)
+            iface = zapi.queryUtility(IDAVNamespace, 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(IDAVNamespace, None, ns)
+            iface = zapi.queryUtility(IDAVNamespace, ns)
             _props[ns] = {'iface': iface, 'props': _avail_props.get(ns)}
         return _props
 

Modified: Zope3/trunk/src/zope/app/dav/tests/test_directives.py
===================================================================
--- Zope3/trunk/src/zope/app/dav/tests/test_directives.py	2004-06-02 01:58:30 UTC (rev 25168)
+++ Zope3/trunk/src/zope/app/dav/tests/test_directives.py	2004-06-02 03:47:07 UTC (rev 25169)
@@ -35,9 +35,9 @@
 
     def test_provideInterface(self):
         utils = zapi.getGlobalService(Utilities)
-        self.assertEqual(utils.queryUtility(IDAVNamespace, name=ns), None)
+        self.assertEqual(utils.queryUtility(IDAVNamespace, ns), None)
         self.context = xmlconfig.file("dav.zcml", zope.app.dav.tests)
-        self.assertEqual(utils.queryUtility(IDAVNamespace, name=ns), ISchema)
+        self.assertEqual(utils.queryUtility(IDAVNamespace, ns), ISchema)
 
 def test_suite():
     return unittest.TestSuite((

Modified: Zope3/trunk/src/zope/app/errorservice/browser/__init__.py
===================================================================
--- Zope3/trunk/src/zope/app/errorservice/browser/__init__.py	2004-06-02 01:58:30 UTC (rev 25168)
+++ Zope3/trunk/src/zope/app/errorservice/browser/__init__.py	2004-06-02 03:47:07 UTC (rev 25169)
@@ -42,7 +42,7 @@
         # redirect the browser to the site root "/@@errorRedirect.html"
         # to handle redirection to the site error logger instead
         try:
-            err = zapi.getService(self, ErrorLogging)
+            err = zapi.getService(ErrorLogging)
             url = str(zapi.getView(err, 'absolute_url', self.request))
             url = url + "/@@SelectedManagementView.html"
         except TypeError:

Modified: Zope3/trunk/src/zope/app/fssync/committer.py
===================================================================
--- Zope3/trunk/src/zope/app/fssync/committer.py	2004-06-02 01:58:30 UTC (rev 25168)
+++ Zope3/trunk/src/zope/app/fssync/committer.py	2004-06-02 03:47:07 UTC (rev 25169)
@@ -394,7 +394,7 @@
             else:
                 iface = IFileFactory
 
-            factory = as.queryNamedAdapter(location, iface, suffix)
+            factory = as.queryAdapter(location, iface, suffix)
             if factory is None:
                 factory = as.queryAdapter(location, iface)
 

Modified: Zope3/trunk/src/zope/app/ftp/__init__.py
===================================================================
--- Zope3/trunk/src/zope/app/ftp/__init__.py	2004-06-02 01:58:30 UTC (rev 25168)
+++ Zope3/trunk/src/zope/app/ftp/__init__.py	2004-06-02 03:47:07 UTC (rev 25169)
@@ -19,7 +19,7 @@
 __metaclass__ = type
 
 from zope.interface import implements
-from zope.component import queryNamedAdapter
+from zope.component import queryAdapter
 from zope.proxy import removeAllProxies
 from zope.publisher.interfaces.ftp import IFTPPublisher
 
@@ -208,7 +208,7 @@
 
         dir = IWriteDirectory(self.context, None)
 
-        factory = queryNamedAdapter(self.context, IFileFactory, ext)
+        factory = queryAdapter(self.context, IFileFactory, ext)
         if factory is None:
             factory = IFileFactory(self.context)
 

Modified: Zope3/trunk/src/zope/app/http/put.py
===================================================================
--- Zope3/trunk/src/zope/app/http/put.py	2004-06-02 01:58:30 UTC (rev 25168)
+++ Zope3/trunk/src/zope/app/http/put.py	2004-06-02 03:47:07 UTC (rev 25169)
@@ -13,7 +13,7 @@
 
 $Id$
 """
-from zope.component import queryNamedAdapter
+from zope.component import queryAdapter
 from zope.app.http.interfaces import INullResource
 from zope.app.filerepresentation.interfaces import IWriteFile
 from zope.app.filerepresentation.interfaces import IWriteDirectory, IFileFactory
@@ -66,7 +66,7 @@
         dir = IWriteDirectory(container, None)
 
         # Now try to get a custom factory for he container
-        factory = queryNamedAdapter(container, IFileFactory, ext)
+        factory = queryAdapter(container, IFileFactory, ext)
 
         # Fall back to a non-custom one
         if factory is None:

Modified: Zope3/trunk/src/zope/app/i18n/tests/testi18ndirectives.py
===================================================================
--- Zope3/trunk/src/zope/app/i18n/tests/testi18ndirectives.py	2004-06-02 01:58:30 UTC (rev 25168)
+++ Zope3/trunk/src/zope/app/i18n/tests/testi18ndirectives.py	2004-06-02 03:47:07 UTC (rev 25169)
@@ -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(ITranslationDomain, name='zope-i18n')
+        util = zapi.getUtility(ITranslationDomain, '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-06-02 01:58:30 UTC (rev 25168)
+++ Zope3/trunk/src/zope/app/i18n/translationdomain.py	2004-06-02 03:47:07 UTC (rev 25169)
@@ -83,7 +83,7 @@
             # If nothing found, delegate to a translation server higher up the
             # tree.
             utils = getNextService(self, Utilities)
-            domain = utils.queryUtility(ITranslationDomain, name=self.domain)
+            domain = utils.queryUtility(ITranslationDomain, self.domain)
             if domain is not None:
                 return domain.translate(msgid, mapping, context,
                                         target_language, default=default)

Modified: Zope3/trunk/src/zope/app/introspector/browser.py
===================================================================
--- Zope3/trunk/src/zope/app/introspector/browser.py	2004-06-02 01:58:30 UTC (rev 25168)
+++ Zope3/trunk/src/zope/app/introspector/browser.py	2004-06-02 03:47:07 UTC (rev 25169)
@@ -33,7 +33,7 @@
         return introspector
 
     def getInterfaceURL(self, name):
-        services = zapi.getService(self.context, Services)
+        services = zapi.getService(Services, self.context)
         try:
             getInterface(self.context, name)
             url = zapi.getView(services, 'absolute_url', self.request)

Modified: Zope3/trunk/src/zope/app/mail/metaconfigure.py
===================================================================
--- Zope3/trunk/src/zope/app/mail/metaconfigure.py	2004-06-02 01:58:30 UTC (rev 25168)
+++ Zope3/trunk/src/zope/app/mail/metaconfigure.py	2004-06-02 03:47:07 UTC (rev 25169)
@@ -45,7 +45,7 @@
         utilities = zapi.getGlobalService('Utilities')
         handler('Utilities', 'provideUtility', IMailDelivery, delivery, name)
 
-        mailerObject = zapi.queryUtility(IMailer, name=mailer)
+        mailerObject = zapi.queryUtility(IMailer, 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(IMailer, name=mailer)
+        mailerObject = zapi.queryUtility(IMailer, mailer)
         if mailerObject is None:
             raise ConfigurationError("Mailer %r is not defined" %mailer)
 

Modified: Zope3/trunk/src/zope/app/menu/__init__.py
===================================================================
--- Zope3/trunk/src/zope/app/menu/__init__.py	2004-06-02 01:58:30 UTC (rev 25168)
+++ Zope3/trunk/src/zope/app/menu/__init__.py	2004-06-02 03:47:07 UTC (rev 25169)
@@ -111,7 +111,7 @@
 
     def getAllLocalMenus(self):
         """See zope.app.publisher.interfaces.browser.IBrowserMenuService"""
-        utilities = zapi.getService(self, Utilities)
+        utilities = zapi.getService(Utilities, self)
         menus = utilities.getLocalUtilitiesFor(ILocalBrowserMenu)
         return map(lambda m: m[1], menus)
 
@@ -126,7 +126,7 @@
 
     def queryLocalMenu(self, menu_id, default=None):
         """See zope.app.interfaces.services.menu.ILocalBrowserMenuService"""
-        utilities = zapi.getService(self, Utilities)
+        utilities = zapi.getService(Utilities, self)
         menus = utilities.getLocalUtilitiesFor(ILocalBrowserMenu)
         for name, menu in menus:
             if name == menu_id:

Modified: Zope3/trunk/src/zope/app/menu/browser/__init__.py
===================================================================
--- Zope3/trunk/src/zope/app/menu/browser/__init__.py	2004-06-02 01:58:30 UTC (rev 25168)
+++ Zope3/trunk/src/zope/app/menu/browser/__init__.py	2004-06-02 03:47:07 UTC (rev 25169)
@@ -56,7 +56,7 @@
 
     def getLocalMenus(self):
         menus_info = []
-        utilities = zapi.getService(self.context, Utilities)
+        utilities = zapi.getService(Utilities)
         for menu_id, menu in utilities.getLocalUtilitiesFor(ILocalBrowserMenu):
             menus_info.append(self._getInfoFromMenu(menu_id, menu))
         return menus_info

Modified: Zope3/trunk/src/zope/app/pagetemplate/engine.py
===================================================================
--- Zope3/trunk/src/zope/app/pagetemplate/engine.py	2004-06-02 01:58:30 UTC (rev 25168)
+++ Zope3/trunk/src/zope/app/pagetemplate/engine.py	2004-06-02 03:47:07 UTC (rev 25169)
@@ -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(IInterpreter, name=lang)
+        interpreter = zapi.queryUtility(IInterpreter, lang)
         if interpreter is None:
             error = _('No interpreter named "${lang_name}" was found.')
             error.mapping = {'lang_name': lang}

Modified: Zope3/trunk/src/zope/app/presentation/presentation.py
===================================================================
--- Zope3/trunk/src/zope/app/presentation/presentation.py	2004-06-02 01:58:30 UTC (rev 25168)
+++ Zope3/trunk/src/zope/app/presentation/presentation.py	2004-06-02 03:47:07 UTC (rev 25169)
@@ -132,8 +132,7 @@
             if layer is None:
                 raise ValueError("Bad layer", layer)
 
-            r = layer.queryNamedAdapter(request, providing,
-                                        name)
+            r = layer.queryAdapter(request, providing, name)
             if r is not None:
                 return r
 

Modified: Zope3/trunk/src/zope/app/publication/tests/test_browserpublication.py
===================================================================
--- Zope3/trunk/src/zope/app/publication/tests/test_browserpublication.py	2004-06-02 01:58:30 UTC (rev 25168)
+++ Zope3/trunk/src/zope/app/publication/tests/test_browserpublication.py	2004-06-02 03:47:07 UTC (rev 25169)
@@ -23,8 +23,6 @@
 from zope.exceptions import ForbiddenAttribute
 from zope.interface import Interface, implements
 
-from zope.component import getService
-
 from zope.publisher.publish import publish
 from zope.publisher.browser import TestRequest
 from zope.app.publisher.browser import BrowserView

Modified: Zope3/trunk/src/zope/app/publication/tests/test_simplecomponenttraverser.py
===================================================================
--- Zope3/trunk/src/zope/app/publication/tests/test_simplecomponenttraverser.py	2004-06-02 01:58:30 UTC (rev 25168)
+++ Zope3/trunk/src/zope/app/publication/tests/test_simplecomponenttraverser.py	2004-06-02 03:47:07 UTC (rev 25169)
@@ -66,7 +66,7 @@
         req = Request(I, '')
 
         T = SimpleComponentTraverser(c, req)
-        getService(None, Presentation).provideView(None , 'foo', I, View)
+        getService(Presentation).provideView(None , 'foo', I, View)
 
         self.failUnless(T.publishTraverse(req,'foo').__class__ is View )
 

Modified: Zope3/trunk/src/zope/app/publication/tests/test_xmlrpcpublication.py
===================================================================
--- Zope3/trunk/src/zope/app/publication/tests/test_xmlrpcpublication.py	2004-06-02 01:58:30 UTC (rev 25168)
+++ Zope3/trunk/src/zope/app/publication/tests/test_xmlrpcpublication.py	2004-06-02 03:47:07 UTC (rev 25169)
@@ -52,7 +52,7 @@
             x = SimpleObject(1)
         ob = C()
         r = self._createRequest('/x', pub)
-        provideView = getService(None, Presentation).provideView
+        provideView = getService(Presentation).provideView
         provideView(None, '', IXMLRPCRequest, TestTraverser,
                     providing=IXMLRPCPublisher)
         ob2 = pub.traverseName(r, ob, 'x')
@@ -76,8 +76,8 @@
 
         ob = C()
         r = self._createRequest('/foo', pub)
-        provideView=getService(None, Presentation).provideView
-        setDefaultViewName=getService(None, Presentation).setDefaultViewName
+        provideView = getService(Presentation).provideView
+        setDefaultViewName = getService(Presentation).setDefaultViewName
         provideView(I, 'view', IXMLRPCPresentation, V)
         setDefaultViewName(I, IXMLRPCPresentation, 'view')
         self.assertRaises(NotFound, pub.traverseName, r, ob, 'foo')
@@ -100,7 +100,7 @@
             implements(IXMLRPCPresentation)
 
         r = self._createRequest('/@@spam', pub)
-        provideView=getService(None, Presentation).provideView
+        provideView = getService(Presentation).provideView
         provideView(I, 'spam', IXMLRPCRequest, V)
         ob2 = pub.traverseName(r, ob, '@@spam')
         self.assertEqual(removeAllProxies(ob2).__class__, V)
@@ -130,8 +130,8 @@
                 return 'foo'
 
         r = self._createRequest('/spam', pub)
-        provideView=getService(None, Presentation).provideView
-        setDefaultViewName=getService(None, Presentation).setDefaultViewName
+        provideView = getService(Presentation).provideView
+        setDefaultViewName = getService(Presentation).setDefaultViewName
         provideView(I, 'view', IXMLRPCRequest, V)
         setDefaultViewName(I, IXMLRPCRequest, 'view')
 

Modified: Zope3/trunk/src/zope/app/publication/tests/test_zopepublication.py
===================================================================
--- Zope3/trunk/src/zope/app/publication/tests/test_zopepublication.py	2004-06-02 01:58:30 UTC (rev 25168)
+++ Zope3/trunk/src/zope/app/publication/tests/test_zopepublication.py	2004-06-02 03:47:07 UTC (rev 25169)
@@ -28,6 +28,7 @@
 from zope.i18n.interfaces import IUserPreferredCharsets
 from zope.component import getGlobalServices
 from zope.component.interfaces import IServiceService
+from zope.component.exceptions import ComponentLookupError
 from zope.publisher.base import TestPublication, TestRequest
 from zope.publisher.http import IHTTPRequest, HTTPCharsets
 from zope.publisher.interfaces import IRequest, IPublishTraverse
@@ -97,11 +98,10 @@
     def __init__(self, auth):
         self.auth = auth
 
-    def queryService(self, name, default=None):
+    def getService(self, name):
         if name == Authentication:
             return self.auth
-        else:
-            return default
+        raise ComponentLookupError(name)
 
 class LocatableObject(Location):
 

Modified: Zope3/trunk/src/zope/app/publication/zopepublication.py
===================================================================
--- Zope3/trunk/src/zope/app/publication/zopepublication.py	2004-06-02 01:58:30 UTC (rev 25168)
+++ Zope3/trunk/src/zope/app/publication/zopepublication.py	2004-06-02 03:47:07 UTC (rev 25169)
@@ -93,8 +93,9 @@
 
         sm = removeAllProxies(ob).getSiteManager()
 
-        auth_service = sm.queryService(Authentication)
-        if auth_service is None:
+        try:
+            auth_service = sm.getService(Authentication)
+        except ComponentLookupError:
             # No auth service here
             return
 

Modified: Zope3/trunk/src/zope/app/publisher/browser/globalbrowsermenuservice.py
===================================================================
--- Zope3/trunk/src/zope/app/publisher/browser/globalbrowsermenuservice.py	2004-06-02 01:58:30 UTC (rev 25168)
+++ Zope3/trunk/src/zope/app/publisher/browser/globalbrowsermenuservice.py	2004-06-02 03:47:07 UTC (rev 25169)
@@ -85,10 +85,8 @@
     implements(IMenuAccessView)
 
     def __getitem__(self, menu_id):
-        browser_menu_service = zapi.getService(self.context, BrowserMenu)
-        return browser_menu_service.getMenu(menu_id,
-                                            self.context,
-                                            self.request)
+        browser_menu_service = zapi.getService(BrowserMenu)
+        return browser_menu_service.getMenu(menu_id, self.context, self.request)
 
 
 class Menu:

Modified: Zope3/trunk/src/zope/app/publisher/browser/managementviewselector.py
===================================================================
--- Zope3/trunk/src/zope/app/publisher/browser/managementviewselector.py	2004-06-02 01:58:30 UTC (rev 25168)
+++ Zope3/trunk/src/zope/app/publisher/browser/managementviewselector.py	2004-06-02 03:47:07 UTC (rev 25169)
@@ -29,7 +29,7 @@
         return self, ()
 
     def __call__(self):
-        browser_menu_service = zapi.getService(self.context, BrowserMenu)
+        browser_menu_service = zapi.getService(BrowserMenu)
         item = browser_menu_service.getFirstMenuItem(
             'zmi_views', self.context, self.request)
 

Modified: Zope3/trunk/src/zope/app/publisher/browser/tests/test_menuaccessview.py
===================================================================
--- Zope3/trunk/src/zope/app/publisher/browser/tests/test_menuaccessview.py	2004-06-02 01:58:30 UTC (rev 25168)
+++ Zope3/trunk/src/zope/app/publisher/browser/tests/test_menuaccessview.py	2004-06-02 03:47:07 UTC (rev 25169)
@@ -18,7 +18,7 @@
 import unittest
 
 from zope.interface import Interface, implements
-from zope.component import getServices, getGlobalServices
+from zope.component import getGlobalServices
 
 from zope.security.management import newInteraction
 from zope.security.checker import defineChecker, NamesChecker, CheckerPublic

Modified: Zope3/trunk/src/zope/app/pythonpage/__init__.py
===================================================================
--- Zope3/trunk/src/zope/app/pythonpage/__init__.py	2004-06-02 01:58:30 UTC (rev 25168)
+++ Zope3/trunk/src/zope/app/pythonpage/__init__.py	2004-06-02 03:47:07 UTC (rev 25169)
@@ -206,6 +206,5 @@
         kw['context'] = zapi.getParent(self)
 
         service = zapi.getService(Utilities)
-        interpreter = service.queryUtility(IInterpreter,
-                                           name='text/server-python')
+        interpreter = service.queryUtility(IInterpreter, '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-06-02 01:58:30 UTC (rev 25168)
+++ Zope3/trunk/src/zope/app/rdb/tests/test_directives.py	2004-06-02 03:47:07 UTC (rev 25169)
@@ -31,11 +31,11 @@
 
         conns = list(zapi.getUtilitiesFor(IZopeDatabaseAdapter))
         self.assertEqual(conns, [])
-        connectionstub = queryUtility(IZopeDatabaseAdapter, None, 'stub')
+        connectionstub = queryUtility(IZopeDatabaseAdapter, 'stub')
         self.assertEqual(connectionstub, None)
 
         self.context = xmlconfig.file("rdb.zcml", zope.app.rdb.tests)
-        connectionstub = queryUtility(IZopeDatabaseAdapter, None, 'stub')
+        connectionstub = queryUtility(IZopeDatabaseAdapter, 'stub')
         connection = connectionstub()
         self.assertEqual(connectionstub.__class__, DAStub)
         conns = zapi.getUtilitiesFor(IZopeDatabaseAdapter)

Modified: Zope3/trunk/src/zope/app/registration/browser/__init__.py
===================================================================
--- Zope3/trunk/src/zope/app/registration/browser/__init__.py	2004-06-02 01:58:30 UTC (rev 25168)
+++ Zope3/trunk/src/zope/app/registration/browser/__init__.py	2004-06-02 03:47:07 UTC (rev 25169)
@@ -123,7 +123,7 @@
 
         message = self.applyUpdates()
 
-        self.configBase = str(getView(getServices(self.context), 'absolute_url',
+        self.configBase = str(getView(getServices(), 'absolute_url',
                                       self.request))
 
         registrations = self.context.info()

Modified: Zope3/trunk/src/zope/app/registration/tests/test_registrationstatusproperty.py
===================================================================
--- Zope3/trunk/src/zope/app/registration/tests/test_registrationstatusproperty.py	2004-06-02 01:58:30 UTC (rev 25168)
+++ Zope3/trunk/src/zope/app/registration/tests/test_registrationstatusproperty.py	2004-06-02 03:47:07 UTC (rev 25169)
@@ -51,12 +51,6 @@
             return self
         raise ComponentLookupError("Wrong service name", name)
 
-    def queryService(self, name, default=None):
-        if name in ("Services", "Utilities"):
-            return self
-        else:
-            return default
-
     def queryLocalService(self, name, default=None):
         if name == "Services":
             return self

Modified: Zope3/trunk/src/zope/app/schema/tests/test_interfaceutility.py
===================================================================
--- Zope3/trunk/src/zope/app/schema/tests/test_interfaceutility.py	2004-06-02 01:58:30 UTC (rev 25168)
+++ Zope3/trunk/src/zope/app/schema/tests/test_interfaceutility.py	2004-06-02 03:47:07 UTC (rev 25169)
@@ -196,13 +196,13 @@
         utilityService.provideUtility(IInterface, Foo("global bob"),
                                             name="bob")
 
-        utility_service = getService(self.rootFolder, Utilities)
+        utility_service = getService(Utilities, self.rootFolder)
         self.assert_(utility_service != utilityService)
 
         self.assertEqual(utility_service.queryUtility(IInterface).foo(),
                          "foo global")
         self.assertEqual(
-            utility_service.queryUtility(IInterface, name="bob").foo(),
+            utility_service.queryUtility(IInterface, "bob").foo(),
             "foo global bob")
 
     def test_getUtility_delegates_to_global(self):
@@ -211,18 +211,18 @@
         utilityService.provideUtility(IInterface, Foo("global bob"),
                                             name="bob")
 
-        utility_service = getService(self.rootFolder, Utilities)
+        utility_service = getService(Utilities, self.rootFolder)
         self.assert_(utility_service != utilityService)
 
         self.assertEqual(utility_service.getUtility(IInterface).foo(),
                          "foo global")
         self.assertEqual(
-            utility_service.getUtility(IInterface, name="bob").foo(),
+            utility_service.getUtility(IInterface, "bob").foo(),
             "foo global bob")
 
 
     def test_registrationsFor_methods(self):
-        utilities = getService(self.rootFolder, Utilities)
+        utilities = getService(Utilities, self.rootFolder)
         default = traverse(self.rootFolder, "++etc++site/default")
         default['foo'] = Foo("local")
         path = "/++etc++site/default/foo"
@@ -243,7 +243,7 @@
         utilityService.provideUtility(IInterface, Foo("global bob"),
                                             name="bob")
 
-        utilities = getService(self.rootFolder, Utilities)
+        utilities = getService(Utilities, self.rootFolder)
         default = traverse(self.rootFolder, "++etc++site/default")
         default['foo'] = Foo("local")
         path = "/++etc++site/default/foo"
@@ -256,18 +256,17 @@
 
             gout = name and "foo global "+name or "foo global"
 
-            self.assertEqual(utilities.getUtility(IInterface, name=name).foo(),
+            self.assertEqual(utilities.getUtility(IInterface, name).foo(),
                              gout)
 
             registration.status = ActiveStatus
 
-            self.assertEqual(utilities.getUtility(IInterface, name=name).foo(),
+            self.assertEqual(utilities.getUtility(IInterface, name).foo(),
                              "foo local")
 
             registration.status = RegisteredStatus
 
-            self.assertEqual(utilities.getUtility(IInterface, name=name).foo(),
-                             gout)
+            self.assertEqual(utilities.getUtility(IInterface, name).foo(), gout)
 
 
 def test_suite():

Modified: Zope3/trunk/src/zope/app/schemacontent/browser/__init__.py
===================================================================
--- Zope3/trunk/src/zope/app/schemacontent/browser/__init__.py	2004-06-02 01:58:30 UTC (rev 25168)
+++ Zope3/trunk/src/zope/app/schemacontent/browser/__init__.py	2004-06-02 03:47:07 UTC (rev 25169)
@@ -141,7 +141,7 @@
             type_name, content_name = name.split("=", 1)
             self.context.contentName = content_name
 
-        utilities = zapi.getService(self.context, Utilities)
+        utilities = zapi.getService(Utilities)
         matching = [util
                     for name, util in utilities.getUtilitiesFor(
                                                   IContentComponentDefinition)

Modified: Zope3/trunk/src/zope/app/schemacontent/content.py
===================================================================
--- Zope3/trunk/src/zope/app/schemacontent/content.py	2004-06-02 01:58:30 UTC (rev 25168)
+++ Zope3/trunk/src/zope/app/schemacontent/content.py	2004-06-02 03:47:07 UTC (rev 25169)
@@ -129,10 +129,13 @@
             # Get the servicem manager and the default package
             sm = zapi.getServices(self.context)
             default = zapi.traverse(sm, 'default')
-            service = sm.queryService(BrowserMenu)
+            try:
+                service = sm.getService(BrowserMenu)
+            except ComponentLookupError:
+                service = None
             # Check whether the service really exists locally; if not, create
             # one for this service manager
-            if (service is None or
+            if (service is None or 
                 not ILocalBrowserMenuService.providedBy(service) or
                 not zapi.name(service) in default):
 
@@ -148,7 +151,7 @@
 
         else:
             # Find a browser menu service and make sure it is a local one.
-            service = zapi.getService(self, BrowserMenu)
+            service = zapi.getService(BrowserMenu, self)
             if not ILocalBrowserMenuService.providedBy(service):
                 raise ComponentLookupError, \
                       _('No local/peristent Browser Menu Service found.')

Modified: Zope3/trunk/src/zope/app/schemacontent/tests/test_content.py
===================================================================
--- Zope3/trunk/src/zope/app/schemacontent/tests/test_content.py	2004-06-02 01:58:30 UTC (rev 25168)
+++ Zope3/trunk/src/zope/app/schemacontent/tests/test_content.py	2004-06-02 03:47:07 UTC (rev 25169)
@@ -94,7 +94,7 @@
     def test_activated(self):
         self.reg.activated()
         self.assertEqual(self.reg.getComponent().name, 'TestDoc')
-        service = zapi.getService(self.rootFolder, BrowserMenu)
+        service = zapi.getService(BrowserMenu, self.rootFolder)
         menu = service.getLocalMenu('add_content')
         self.assertEqual('TestDoc', menu['1'].title)
         mi = IContentComponentMenuItem(self.reg.getComponent())

Modified: Zope3/trunk/src/zope/app/security/permission.py
===================================================================
--- Zope3/trunk/src/zope/app/security/permission.py	2004-06-02 01:58:30 UTC (rev 25168)
+++ Zope3/trunk/src/zope/app/security/permission.py	2004-06-02 03:47:07 UTC (rev 25169)
@@ -50,7 +50,7 @@
     """
     if permission_id == CheckerPublic:
         return
-    if not zapi.queryUtility(IPermission, name=permission_id, context=context):
+    if not zapi.queryUtility(IPermission, permission_id, context=context):
         raise ValueError("Undefined permission id", permission_id)
 
 def allPermissions(context=None):

Modified: Zope3/trunk/src/zope/app/security/principal.py
===================================================================
--- Zope3/trunk/src/zope/app/security/principal.py	2004-06-02 01:58:30 UTC (rev 25168)
+++ Zope3/trunk/src/zope/app/security/principal.py	2004-06-02 03:47:07 UTC (rev 25169)
@@ -22,7 +22,7 @@
 def checkPrincipal(context, principal_id):
 
     try:
-        if zapi.getService(context, Authentication).getPrincipal(principal_id):
+        if zapi.getService(Authentication, context).getPrincipal(principal_id):
             return
     except NotFoundError:
         pass

Modified: Zope3/trunk/src/zope/app/security/principalregistry.py
===================================================================
--- Zope3/trunk/src/zope/app/security/principalregistry.py	2004-06-02 01:58:30 UTC (rev 25168)
+++ Zope3/trunk/src/zope/app/security/principalregistry.py	2004-06-02 03:47:07 UTC (rev 25169)
@@ -36,7 +36,7 @@
     # Methods implementing IAuthenticationService
 
     def authenticate(self, request):
-        a = zapi.queryAdapter(request, ILoginPassword, None)
+        a = zapi.queryAdapter(request, ILoginPassword)
         if a is not None:
             login = a.getLogin()
             if login is not None:

Modified: Zope3/trunk/src/zope/app/securitypolicy/browser/principalpermissionview.py
===================================================================
--- Zope3/trunk/src/zope/app/securitypolicy/browser/principalpermissionview.py	2004-06-02 01:58:30 UTC (rev 25168)
+++ Zope3/trunk/src/zope/app/securitypolicy/browser/principalpermissionview.py	2004-06-02 03:47:07 UTC (rev 25169)
@@ -34,9 +34,7 @@
     index = ViewPageTemplateFile('principal_permission_edit.pt')
 
     def get_principal(self, principal_id):
-        return zapi.getService(self.context,
-                          Authentication
-                          ).getPrincipal(principal_id)
+        return zapi.getService(Authentication).getPrincipal(principal_id)
 
     def unsetPermissions(self, principal_id, permission_ids, REQUEST=None):
         """Form action unsetting a principals permissions"""

Modified: Zope3/trunk/src/zope/app/securitypolicy/browser/principalroleview.py
===================================================================
--- Zope3/trunk/src/zope/app/securitypolicy/browser/principalroleview.py	2004-06-02 01:58:30 UTC (rev 25168)
+++ Zope3/trunk/src/zope/app/securitypolicy/browser/principalroleview.py	2004-06-02 03:47:07 UTC (rev 25169)
@@ -32,9 +32,8 @@
     def getAllPrincipals(self):
         principals = getattr(self, '_principals', None)
         if principals is None:
-            principals = self._principals = zapi.getService(
-                self.context, Authentication
-                ).getPrincipals('')
+            auth = zapi.getService(Authentication)
+            principals = self._principals = auth.getPrincipals('')
         return principals
 
     def getAllRoles(self):
@@ -52,7 +51,7 @@
                 principals = self.getAllPrincipals()
             else:
                 # Ugh, we have ids, but we want objects
-                auth_service = zapi.getService(self.context, Authentication)
+                auth_service = zapi.getService(Authentication)
                 principals = [auth_service.getPrincipal(principal)
                               for principal in principals]
 

Modified: Zope3/trunk/src/zope/app/securitypolicy/browser/rolepermissionview.py
===================================================================
--- Zope3/trunk/src/zope/app/securitypolicy/browser/rolepermissionview.py	2004-06-02 01:58:30 UTC (rev 25168)
+++ Zope3/trunk/src/zope/app/securitypolicy/browser/rolepermissionview.py	2004-06-02 03:47:07 UTC (rev 25169)
@@ -68,7 +68,7 @@
 
     def roleForID(self, rid):
         permissions = self.permissions()
-        role = zapi.getUtility(IRole, name=rid)
+        role = zapi.getUtility(IRole, rid)
         return RolePermissions(role, self.context, permissions)
 
 

Modified: Zope3/trunk/src/zope/app/securitypolicy/tests/test_securitydirectives.py
===================================================================
--- Zope3/trunk/src/zope/app/securitypolicy/tests/test_securitydirectives.py	2004-06-02 01:58:30 UTC (rev 25168)
+++ Zope3/trunk/src/zope/app/securitypolicy/tests/test_securitydirectives.py	2004-06-02 03:47:07 UTC (rev 25169)
@@ -64,7 +64,7 @@
         context = xmlconfig.file("role.zcml",
                                  zope.app.securitypolicy.tests)
 
-        role = zapi.getUtility(IRole, name="zope.Everyperson")
+        role = zapi.getUtility(IRole, "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/site/browser/__init__.py
===================================================================
--- Zope3/trunk/src/zope/app/site/browser/__init__.py	2004-06-02 01:58:30 UTC (rev 25168)
+++ Zope3/trunk/src/zope/app/site/browser/__init__.py	2004-06-02 03:47:07 UTC (rev 25169)
@@ -31,6 +31,7 @@
 from zope.app.site.service import SiteManager
 from zope.app.component.localservice import getNextServices
 from zope.component.service import IGlobalServiceManager
+from zope.component.exceptions import ComponentLookupError
 from zope.component.interfaces import IFactory
 from zope.interface.interfaces import IMethod
 from zope.schema.interfaces import IField
@@ -75,6 +76,7 @@
         super(ComponentAdding, self).action(type_name, id)
 
     _addFilterInterface = None
+
     def addingInfo(self):
         # A site management folder can have many things. We only want 
         # things that implement a particular interface
@@ -87,8 +89,7 @@
             if extra:
                 factoryname = extra.get('factory')
                 if factoryname:
-                    factory = zapi.getUtility(self.context, IFactory,
-                                              factoryname)
+                    factory = zapi.getUtility(IFactory, factoryname)
                     intf = factory.getInterfaces()
                     if not intf.extends(self._addFilterInterface):
                         # We only skip new addMenuItem style objects
@@ -117,7 +118,7 @@
         content = super(ServiceAdding, self).add(content)
 
         # figure out the interfaces that this service implements
-        sm = zapi.getServices(self.context)
+        sm = zapi.getServices()
         implements = []
         for type_name, interface in sm.getServiceDefinitions():
             if interface.providedBy(content):
@@ -169,7 +170,7 @@
     def listServiceTypes(self):
 
         # Collect all defined services interfaces that it implements.
-        sm = zapi.getServices(self.context)
+        sm = zapi.getServices()
         lst = []
         for servicename, interface in sm.getServiceDefinitions():
             if interface.providedBy(self.context):
@@ -324,7 +325,11 @@
             if items.has_key(type_name):
                 # a child has already supplied one of these
                 continue
-            if sm.queryService(type_name) is not None:
+            try:
+                sm.getService(type_name)
+            except ComponentLookupError:
+                pass
+            else:
                 names.append(type_name)
                 items[type_name] = {'name': type_name, 'url': '',
                     'parent': _('global'), 'disabled': False,
@@ -366,12 +371,12 @@
     'type' determines which service is to be configured."""
 
     def isDisabled(self):
-        sm = zapi.getServices(self.context)
+        sm = zapi.getServices()
         registry = sm.queryRegistrations(self.request.get('type'))
         return not (registry and registry.active())
 
     def listRegistry(self):
-        sm = zapi.getServices(self.context)
+        sm = zapi.getServices()
         registry = sm.queryRegistrations(self.request.get('type'))
         if not registry:
             return []
@@ -405,7 +410,7 @@
         if not active:
             return ""
 
-        sm = zapi.getServices(self.context)
+        sm = zapi.getServices()
         registry = sm.queryRegistrations(self.request.get('type'))
         if not registry:
             return _("Invalid service type specified")
@@ -609,17 +614,19 @@
         where the service dicts contains keys "name" and "registrations."
         registrations is a list of IRegistrations.
         """
-        sm = zapi.getServices(self.context)
+        sm = zapi.getServices()
         for name, iface in sm.getServiceDefinitions():
-            service = sm.queryService(name)
-            if service is None:
-                continue
-            registry = IInterfaceBasedRegistry(service, None)
-            if registry is None:
-                continue
-            regs = list(registry.getRegistrationsForInterface(self.iface))
-            if regs:
-                yield {"name": name, "registrations": regs}
+            try:
+                service = sm.getService(name)
+            except ComponentLookupError:
+                pass
+            else:
+                registry = IInterfaceBasedRegistry(service, None)
+                if registry is not None:
+                    regs = list(registry.getRegistrationsForInterface(
+                        self.iface))
+                    if regs:
+                        yield {"name": name, "registrations": regs}
             
 
 class MethodDetail:

Modified: Zope3/trunk/src/zope/app/site/browser/ftests/test_utilitytools.py
===================================================================
--- Zope3/trunk/src/zope/app/site/browser/ftests/test_utilitytools.py	2004-06-02 01:58:30 UTC (rev 25168)
+++ Zope3/trunk/src/zope/app/site/browser/ftests/test_utilitytools.py	2004-06-02 03:47:07 UTC (rev 25169)
@@ -103,8 +103,7 @@
                   'APPLY_RENAME': 'Rename'})
 
         root = self.getRootFolder()
-        util = zapi.queryUtility(ITranslationDomain, name='newzope',
-                                 context=root)
+        util = zapi.queryUtility(ITranslationDomain, 'newzope', context=root)
         self.assert_(util is not None)
 
     def testDeactivate(self):
@@ -126,7 +125,7 @@
                   'DEACTIVATE': 'Rename'})
 
         root = self.getRootFolder()
-        utils = zapi.getService(root, 'Utilities')
+        utils = zapi.getService('Utilities', root)
         reg = utils.queryRegistrations('zope', ITranslationDomain)
 
         for info in reg.info():
@@ -157,7 +156,7 @@
                   'ACTIVATE': 'Rename'})
 
         root = self.getRootFolder()
-        utils = zapi.getService(root, 'Utilities')
+        utils = zapi.getService('Utilities', root)
         reg = utils.queryRegistrations('zope', ITranslationDomain)
 
         for info in reg.info():

Modified: Zope3/trunk/src/zope/app/site/browser/tools.py
===================================================================
--- Zope3/trunk/src/zope/app/site/browser/tools.py	2004-06-02 01:58:30 UTC (rev 25168)
+++ Zope3/trunk/src/zope/app/site/browser/tools.py	2004-06-02 03:47:07 UTC (rev 25169)
@@ -232,7 +232,7 @@
 
     def delete(self):
         for name in self.request.form['selected']:
-            utils = zapi.getService(self, Utilities)
+            utils = zapi.getService(Utilities)
             reg = utils.queryRegistrations(name, self.interface)
 
             del_objs = []
@@ -260,7 +260,7 @@
             newname = self.request.form['new_names'][
                 self.request.form['old_names'].index(name)]
             
-            utils = zapi.getService(self, 'Utilities')
+            utils = zapi.getService('Utilities')
             reg = utils.queryRegistrations(name, self.interface)
 
             # Rename registrations
@@ -273,7 +273,7 @@
 
     def activate(self):
         for name in self.request.form['selected']:
-            utils = zapi.getService(self, 'Utilities')
+            utils = zapi.getService('Utilities')
             reg = utils.queryRegistrations(name, self.interface)
 
             # Activate registrations
@@ -283,7 +283,7 @@
         
     def deactivate(self):
         for name in self.request.form['selected']:
-            utils = zapi.getService(self, 'Utilities')
+            utils = zapi.getService('Utilities')
             reg = utils.queryRegistrations(name, self.interface)
 
             # Deactivate registrations
@@ -318,7 +318,7 @@
         return status
     
     def getComponents(self):
-        utils = zapi.getService(self.context, Utilities)
+        utils = zapi.getService(Utilities)
         items = []
         for registration in [reg for reg in utils.registrations(localOnly=True)
                              if reg.provided == self.interface]:

Modified: Zope3/trunk/src/zope/app/site/service.py
===================================================================
--- Zope3/trunk/src/zope/app/site/service.py	2004-06-02 01:58:30 UTC (rev 25168)
+++ Zope3/trunk/src/zope/app/site/service.py	2004-06-02 03:47:07 UTC (rev 25169)
@@ -162,14 +162,6 @@
 
         return serviceDefs
 
-    def queryService(self, name, default=None):
-        """See IServiceService
-        """
-        try:
-            return self.getService(name)
-        except ComponentLookupError:
-            return default
-
     def getService(self, name):
         """See IServiceService
         """

Modified: Zope3/trunk/src/zope/app/site/tests/test_servicemanager.py
===================================================================
--- Zope3/trunk/src/zope/app/site/tests/test_servicemanager.py	2004-06-02 01:58:30 UTC (rev 25168)
+++ Zope3/trunk/src/zope/app/site/tests/test_servicemanager.py	2004-06-02 03:47:07 UTC (rev 25169)
@@ -56,7 +56,7 @@
         name = rm.addRegistration(registration)
         traverse(rm, name).status = ActiveStatus
 
-        testOb = getService(self.rootFolder, 'test_service')
+        testOb = getService('test_service', self.rootFolder)
         self.assertEqual(testOb.__parent__.__parent__.__parent__,
                          self.rootFolder)
         self.assertEqual(testOb, ts)
@@ -117,7 +117,7 @@
         name = rm.addRegistration(registration)
         traverse(rm, name).status = RegisteredStatus
 
-        testOb = getService(self.rootFolder, 'test_service')
+        testOb = getService('test_service', self.rootFolder)
         self.assertEqual(testOb, ts1)
 
 
@@ -133,12 +133,12 @@
         cm = traverse(sm, 'default').getRegistrationManager()
         traverse(cm, name).status = UnregisteredStatus
 
-        self.assertEqual(getService(self.rootFolder, 'test_service'), root_ts)
+        self.assertEqual(getService('test_service', self.rootFolder), root_ts)
 
     def testContextServiceLookup(self):
         self.testGetService() # set up localservice
         sm = getServices(self.rootFolder)
-        self.assertEqual(getService(self.folder1_1, 'test_service'),
+        self.assertEqual(getService('test_service', self.folder1_1),
                          sm['default']['test_service1'])
 
     def testContextServiceLookupWithMultipleServiceManagers(self):
@@ -147,7 +147,7 @@
 
         sm2 = self.makeSite('folder1')
 
-        self.assertEqual(getService(self.folder1, 'test_service'),
+        self.assertEqual(getService('test_service', self.folder1),
                          sm['default']['test_service1'])
 
     def testComponentArchitectureServiceLookup(self):
@@ -159,7 +159,7 @@
         globsm = getGlobalServices()
         globsm.provideService('test_service', ts)
 
-        service = getService(self.folder1, 'test_service')
+        service = getService('test_service', self.folder1)
         self.assertEqual(service, ts)
 
     def donttest_resolve(self):

Modified: Zope3/trunk/src/zope/app/sqlexpr/sqlexpr.py
===================================================================
--- Zope3/trunk/src/zope/app/sqlexpr/sqlexpr.py	2004-06-02 01:58:30 UTC (rev 25168)
+++ Zope3/trunk/src/zope/app/sqlexpr/sqlexpr.py	2004-06-02 03:47:07 UTC (rev 25169)
@@ -75,8 +75,8 @@
             # XXX: It is hard set that the connection name variable is called
             # 'sql_conn'
             conn_name = econtext.vars['sql_conn']
-            connection_service = getService(econtext.context,
-                                            "SQLDatabaseConnections")
+            connection_service = getService("SQLDatabaseConnections",
+                                            econtext.context)
             connection = connection_service.getConnection(conn_name)
         elif econtext.vars.has_key('rdb') and econtext.vars.has_key('dsn'):
             rdb = econtext.vars['rdb']

Modified: Zope3/trunk/src/zope/app/sqlscript/interfaces.py
===================================================================
--- Zope3/trunk/src/zope/app/sqlscript/interfaces.py	2004-06-02 01:58:30 UTC (rev 25168)
+++ Zope3/trunk/src/zope/app/sqlscript/interfaces.py	2004-06-02 03:47:07 UTC (rev 25169)
@@ -17,7 +17,6 @@
 import zope.schema
 from zope.app import zapi
 from zope.app.rdb.interfaces import ISQLCommand
-from zope.component import getService, ComponentLookupError
 from zope.app.i18n import ZopeMessageIDFactory as _
 
 class MissingInput(Exception):

Modified: Zope3/trunk/src/zope/app/sqlscript/tests/test_sqlscript.py
===================================================================
--- Zope3/trunk/src/zope/app/sqlscript/tests/test_sqlscript.py	2004-06-02 01:58:30 UTC (rev 25168)
+++ Zope3/trunk/src/zope/app/sqlscript/tests/test_sqlscript.py	2004-06-02 03:47:07 UTC (rev 25169)
@@ -16,7 +16,6 @@
 """
 import unittest
 from zope.interface import implements, classImplements
-from zope.component import getService
 from zope.component.service import serviceManager as sm
 
 from zope.app.tests import ztapi

Modified: Zope3/trunk/src/zope/app/traversing/namespace.py
===================================================================
--- Zope3/trunk/src/zope/app/traversing/namespace.py	2004-06-02 01:58:30 UTC (rev 25168)
+++ Zope3/trunk/src/zope/app/traversing/namespace.py	2004-06-02 03:47:07 UTC (rev 25169)
@@ -98,7 +98,7 @@
         traverser = component.queryView(object, ns, request,
                                         providing=ITraversable)
     else:
-        traverser = component.queryNamedAdapter(object, ITraversable, ns)
+        traverser = component.queryAdapter(object, ITraversable, ns)
 
     if traverser is None:
         raise NotFoundError("++%s++%s" % (ns, name))

Modified: Zope3/trunk/src/zope/app/traversing/tests/test_conveniencefunctions.py
===================================================================
--- Zope3/trunk/src/zope/app/traversing/tests/test_conveniencefunctions.py	2004-06-02 01:58:30 UTC (rev 25168)
+++ Zope3/trunk/src/zope/app/traversing/tests/test_conveniencefunctions.py	2004-06-02 03:47:07 UTC (rev 25169)
@@ -20,7 +20,6 @@
 from zope.interface import directlyProvides
 from zope.app.site.tests.placefulsetup import PlacefulSetup
 from zope.app.traversing.adapters import Traverser
-from zope.component import getService
 from zope.app.servicenames import Adapters
 from zope.app.traversing.interfaces import ITraverser, ITraversable
 from zope.app.traversing.adapters import DefaultTraversable

Modified: Zope3/trunk/src/zope/app/traversing/tests/test_traverser.py
===================================================================
--- Zope3/trunk/src/zope/app/traversing/tests/test_traverser.py	2004-06-02 01:58:30 UTC (rev 25168)
+++ Zope3/trunk/src/zope/app/traversing/tests/test_traverser.py	2004-06-02 03:47:07 UTC (rev 25169)
@@ -33,7 +33,6 @@
 from zope.app.container.contained import contained
 
 from zope.exceptions import NotFoundError, Unauthorized
-from zope.component import getService
 from zope.app.servicenames import Adapters
 
 from zope.app.site.tests.placefulsetup import PlacefulSetup

Modified: Zope3/trunk/src/zope/app/undo/browser.py
===================================================================
--- Zope3/trunk/src/zope/app/undo/browser.py	2004-06-02 01:58:30 UTC (rev 25168)
+++ Zope3/trunk/src/zope/app/undo/browser.py	2004-06-02 03:47:07 UTC (rev 25169)
@@ -51,7 +51,7 @@
 
     def undoAllTransactions(self, ids):
         """Undo transactions specified in 'ids'."""
-        undo = zapi.getUtility(self.context, IUndoManager)
+        undo = zapi.getUtility(IUndoManager)
         undo.undoTransactions(ids)
         self._redirect()
 

Modified: Zope3/trunk/src/zope/app/utility/tests.py
===================================================================
--- Zope3/trunk/src/zope/app/utility/tests.py	2004-06-02 01:58:30 UTC (rev 25168)
+++ Zope3/trunk/src/zope/app/utility/tests.py	2004-06-02 03:47:07 UTC (rev 25169)
@@ -94,7 +94,7 @@
         utilityService.provideUtility(IFoo, Foo("global bob"),
                                             name="bob")
 
-        utility_service = getService(self.rootFolder, "Utilities")
+        utility_service = getService("Utilities", self.rootFolder)
 
         # We changed the root (base) service. This doesn't normally
         # occur.  We have to notify the local service that the base
@@ -105,16 +105,16 @@
 
         self.assertEqual(utility_service.queryUtility(IFoo).foo(),
                          "foo global")
-        self.assertEqual(utility_service.queryUtility(IFoo, name="bob").foo(),
+        self.assertEqual(utility_service.queryUtility(IFoo, "bob").foo(),
                          "foo global bob")
         self.assertEqual(utility_service.queryUtility(IFo).foo(),
                          "foo global")
-        self.assertEqual(utility_service.queryUtility(IFo, name="bob").foo(),
+        self.assertEqual(utility_service.queryUtility(IFo, "bob").foo(),
                          "foo global bob")
 
         self.assertEqual(utility_service.queryUtility(IBar), None)
-        self.assertEqual(utility_service.queryUtility(IBar, name="bob"), None)
-        self.assertEqual(utility_service.queryUtility(IFoo, name="rob"), None)
+        self.assertEqual(utility_service.queryUtility(IBar, "bob"), None)
+        self.assertEqual(utility_service.queryUtility(IFoo, "rob"), None)
 
     def test_getUtility_delegates_to_global(self):
         utilityService = zapi.getGlobalService(zapi.servicenames.Utilities)
@@ -122,29 +122,29 @@
         utilityService.provideUtility(IFoo, Foo("global bob"),
                                             name="bob")
 
-        utility_service = getService(self.rootFolder, "Utilities")
+        utility_service = getService("Utilities", self.rootFolder)
         self.assert_(utility_service != utilityService)
 
         self.assertEqual(utility_service.getUtility(IFoo).foo(),
                          "foo global")
-        self.assertEqual(utility_service.getUtility(IFoo, name="bob").foo(),
+        self.assertEqual(utility_service.getUtility(IFoo, "bob").foo(),
                          "foo global bob")
         self.assertEqual(utility_service.getUtility(IFo).foo(),
                          "foo global")
-        self.assertEqual(utility_service.getUtility(IFo, name="bob").foo(),
+        self.assertEqual(utility_service.getUtility(IFo, "bob").foo(),
                          "foo global bob")
 
 
         self.assertRaises(ComponentLookupError,
                           utility_service.getUtility, IBar)
         self.assertRaises(ComponentLookupError,
-                          utility_service.getUtility, IBar, name='bob')
+                          utility_service.getUtility, IBar, 'bob')
         self.assertRaises(ComponentLookupError,
-                          utility_service.getUtility, IFoo, name='rob')
+                          utility_service.getUtility, IFoo, 'rob')
 
 
     def test_registrationsFor_methods(self):
-        utilities = getService(self.rootFolder, "Utilities")
+        utilities = getService("Utilities", self.rootFolder)
         default = traverse(self.rootFolder, "++etc++site/default")
         default['foo'] = Foo("local")
         path = "/++etc++site/default/foo"
@@ -165,7 +165,7 @@
         utilityService.provideUtility(IFoo, Foo("global bob"),
                                             name="bob")
 
-        utilities = getService(self.rootFolder, "Utilities")
+        utilities = getService("Utilities", self.rootFolder)
 
         # We changed the root (base) service. This doesn't normally
         # occur.  We have to notify the local service that the base
@@ -184,16 +184,16 @@
 
             gout = name and "foo global "+name or "foo global"
 
-            self.assertEqual(utilities.getUtility(IFoo, name=name).foo(), gout)
+            self.assertEqual(utilities.getUtility(IFoo, name).foo(), gout)
 
             registration.status = ActiveStatus
 
-            self.assertEqual(utilities.getUtility(IFoo, name=name).foo(),
+            self.assertEqual(utilities.getUtility(IFoo, name).foo(),
                              "foo local")
 
             registration.status = RegisteredStatus
 
-            self.assertEqual(utilities.getUtility(IFoo, name=name).foo(), gout)
+            self.assertEqual(utilities.getUtility(IFoo, name).foo(), gout)
 
 
     def test_local_overrides(self):
@@ -207,10 +207,10 @@
         setup.addUtility(sm2, 'u2', IFoo, Foo('u22'))
 
         # Make sure we acquire:
-        self.assertEqual(zapi.getUtility(IFoo, 'u1', context=sm2).name, 'u1')
+        self.assertEqual(zapi.getUtility(IFoo, 'u1', sm2).name, 'u1')
 
         # Make sure we override:
-        self.assertEqual(zapi.getUtility(IFoo, 'u2', context=sm2).name, 'u22')
+        self.assertEqual(zapi.getUtility(IFoo, 'u2', sm2).name, 'u22')
 
 
 def test_suite():

Modified: Zope3/trunk/src/zope/app/wiki/tests/test_traverser.py
===================================================================
--- Zope3/trunk/src/zope/app/wiki/tests/test_traverser.py	2004-06-02 01:58:30 UTC (rev 25168)
+++ Zope3/trunk/src/zope/app/wiki/tests/test_traverser.py	2004-06-02 03:47:07 UTC (rev 25169)
@@ -72,8 +72,7 @@
         request = Request(I, '')
 
         T = WikiPageTraverser(page1, request)
-        getService(None, Presentation).provideView(
-            IWikiPage, 'viewfoo', I, View)
+        getService(Presentation).provideView(IWikiPage, 'viewfoo', I, View)
 
         self.failUnless(
             T.publishTraverse(request, 'viewfoo').__class__ is View )

Modified: Zope3/trunk/src/zope/app/workflow/definition.py
===================================================================
--- Zope3/trunk/src/zope/app/workflow/definition.py	2004-06-02 01:58:30 UTC (rev 25168)
+++ Zope3/trunk/src/zope/app/workflow/definition.py	2004-06-02 03:47:07 UTC (rev 25169)
@@ -110,7 +110,7 @@
     implements(IVocabulary, IVocabularyTokenized)
 
     def __init__(self, context):
-        self.utilities = zapi.getService(context, Utilities)
+        self.utilities = zapi.getService(Utilities, context)
 
     def __names(self):
         return [name for name, util in self.utilities.getUtilitiesFor(

Modified: Zope3/trunk/src/zope/app/workflow/instance.py
===================================================================
--- Zope3/trunk/src/zope/app/workflow/instance.py	2004-06-02 01:58:30 UTC (rev 25168)
+++ Zope3/trunk/src/zope/app/workflow/instance.py	2004-06-02 03:47:07 UTC (rev 25169)
@@ -50,7 +50,7 @@
 def createProcessInstance(context, name):
     """Helper function to create a process instance from a process definition
     name."""
-    utils = zapi.getService(context, Utilities)
+    utils = zapi.getService(Utilities, context)
     pd = utils.getUtility(IProcessDefinition, name)
     return pd.createProcessInstance(name)
 

Modified: Zope3/trunk/src/zope/app/workflow/stateful/browser/instance.py
===================================================================
--- Zope3/trunk/src/zope/app/workflow/stateful/browser/instance.py	2004-06-02 01:58:30 UTC (rev 25168)
+++ Zope3/trunk/src/zope/app/workflow/stateful/browser/instance.py	2004-06-02 03:47:07 UTC (rev 25169)
@@ -123,7 +123,7 @@
 
 
     def _getProcessDefinition(self, processInstance):
-        utils = zapi.getService(self.context, Utilities)
+        utils = zapi.getService(Utilities)
         return utils.getUtility(IProcessDefinition,
                                 processInstance.processDefinitionName)
 

Modified: Zope3/trunk/src/zope/app/workflow/stateful/instance.py
===================================================================
--- Zope3/trunk/src/zope/app/workflow/stateful/instance.py	2004-06-02 01:58:30 UTC (rev 25168)
+++ Zope3/trunk/src/zope/app/workflow/stateful/instance.py	2004-06-02 03:47:07 UTC (rev 25169)
@@ -217,8 +217,7 @@
 
     def getProcessDefinition(self):
         """Get the ProcessDefinition object from WorkflowService."""
-        utils = zapi.getService(self, Utilities)
-        return utils.getUtility(IProcessDefinition, self.processDefinitionName)
+        return zapi.getUtility(IProcessDefinition, self.processDefinitionName)
 
     # XXX this is not entirely tested
     def _getContext(self):

Modified: Zope3/trunk/src/zope/app/workflow/stateful/tests/test_instance.py
===================================================================
--- Zope3/trunk/src/zope/app/workflow/stateful/tests/test_instance.py	2004-06-02 01:58:30 UTC (rev 25168)
+++ Zope3/trunk/src/zope/app/workflow/stateful/tests/test_instance.py	2004-06-02 03:47:07 UTC (rev 25169)
@@ -107,7 +107,7 @@
         zapi.traverse(self.default.getRegistrationManager(),
                       name).status = ActiveStatus
 
-        utilities = zapi.getService(self.sm, Utilities)
+        utilities = zapi.getService(Utilities, self.sm)
         self.pd = utilities.getUtility(IProcessDefinition, 'definition1')
         # give the pi some context to find a service
         self.pi = createProcessInstance(self.sm, 'definition1')
@@ -219,7 +219,7 @@
         zapi.traverse(self.default.getRegistrationManager(), n
                       ).status = ActiveStatus
 
-        utilities = zapi.getService(self.sm, Utilities)
+        utilities = zapi.getService(Utilities, self.sm)
         self.pd = utilities.getUtility(IProcessDefinition, 'definition1')
         # give the pi some context to find a service
         self.pi = contained(
@@ -306,7 +306,7 @@
         zapi.traverse(self.default.getRegistrationManager(),
                       k).status = ActiveStatus
 
-        utilities = zapi.getService(self.sm, Utilities)
+        utilities = zapi.getService(Utilities, self.sm)
         self.pd = utilities.getUtility(IProcessDefinition, 'definition1')
         # give the pi some context to find a service
         self.pi = contained(
@@ -392,7 +392,7 @@
         zapi.traverse(self.default.getRegistrationManager(),
                       k).status = ActiveStatus
 
-        utilities = zapi.getService(self.sm, Utilities)
+        utilities = zapi.getService(Utilities, self.sm)
         self.pd = utilities.getUtility(IProcessDefinition, 'definition1')
         # give the process instance container (pic) some context to find a
         # service (while this is not correct, it resembles the current

Modified: Zope3/trunk/src/zope/app/workflow/tests/workflowsetup.py
===================================================================
--- Zope3/trunk/src/zope/app/workflow/tests/workflowsetup.py	2004-06-02 01:58:30 UTC (rev 25168)
+++ Zope3/trunk/src/zope/app/workflow/tests/workflowsetup.py	2004-06-02 03:47:07 UTC (rev 25169)
@@ -49,4 +49,4 @@
     def setupAuthService(self):
         self.root_sm.defineService(Authentication, IAuthenticationService)
         self.root_sm.provideService(Authentication, principalRegistry)
-        return zapi.getService(self.rootFolder, Authentication)
+        return zapi.getService(Authentication, self.rootFolder)

Modified: Zope3/trunk/src/zope/component/__init__.py
===================================================================
--- Zope3/trunk/src/zope/component/__init__.py	2004-06-02 01:58:30 UTC (rev 25168)
+++ Zope3/trunk/src/zope/component/__init__.py	2004-06-02 03:47:07 UTC (rev 25169)
@@ -89,19 +89,11 @@
     # Deprecated backwards-compatibility hack.
     if isinstance(context, basestring) and not isinstance(name, basestring):
         name, context = context, name
-        ##warnings.warn("getService(context, name) is deprecated."
-        ##              "  Use getService(name, context=context).",
-        ##              DeprecationWarning, warningLevel())
+        warnings.warn("getService(context, name) is deprecated."
+                      "  Use getService(name, context=context).",
+                      DeprecationWarning, warningLevel())
     return getServices(context).getService(name)
 
-def queryService(context, name, default=None):
-    # Leaving the API in the older style of context, name, default because
-    # this function is deprecated anyway.
-    ##warnings.warn("queryService is deprecated.  Client code should depend"
-    ##              "  on the service existing.  Use getService instead.",
-    ##              DeprecationWarning, warningLevel())
-    return getServices(context).queryService(name, default)
-
 def getServiceDefinitions(context=None):
     return getServices(context).getServiceDefinitions()
 
@@ -117,15 +109,16 @@
                       DeprecationWarning, warningLevel())
     return getService(Utilities, context=context).getUtility(interface, name)
 
-def queryUtility(interface, default=None, name='', context=None):
+def queryUtility(interface, name='', default=None, context=None):
     ## XXX this check is for migration.  Remove soon.
     if (not IInterface.providedBy(interface) or
-        not isinstance(name, basestring)):
+        not isinstance(name, basestring) or
+        isinstance(default, basestring)):
         raise TypeError("queryUtility got nonsense arguments."
                         " Check that you are updated with the"
                         " component API change.")
     return getService(Utilities, context).queryUtility(
-        interface, default, name)
+        interface, name, default)
 
 def getUtilitiesFor(interface, context=None):
     if not IInterface.providedBy(interface):
@@ -143,17 +136,12 @@
 # Adapter service
 
 def getAdapter(object, interface, name='', context=None):
-    adapter = queryAdapter(object, interface, None, name, context)
+    adapter = queryAdapter(object, interface, name, None, context)
     if adapter is None:
         raise ComponentLookupError(object, interface)
     return adapter
 
-def queryAdapter(object, interface, default=None, name='', context=None):
-    if name:
-        warnings.warn("The name argument to queryAdapter is deprecated",
-                      DeprecationWarning, warningLevel())
-        return queryNamedAdapter(object, interface, name, default, context)
-
+def queryAdapter(object, interface, name='', default=None, context=None):
     conform = getattr(object, '__conform__', None)
     if conform is not None:
         try:
@@ -178,27 +166,9 @@
     if interface.providedBy(object):
         return object
 
-    return queryNamedAdapter(object, interface, name, default, context)
+    adapters = getService(Adapters, context)
+    return adapters.queryAdapter(object, interface, name, default)
 
-def getNamedAdapter(object, interface, name, context=None):
-    adapter = queryNamedAdapter(object, interface, name, context=context)
-    if adapter is None:
-        raise ComponentLookupError(object, interface)
-    return adapter
-
-def queryNamedAdapter(object, interface, name, default=None, context=None):
-    try:
-        adapters = getService(Adapters, context)
-    except ComponentLookupError:
-        # Oh blast, no adapter service. We're probably just running from a test
-        #warnings.warn("There is no adapters service.  Returning the default.",
-        #              DeprecationWarning, warningLevel())
-        return default
-
-    return adapters.queryNamedAdapter(object, interface, name, default)
-
-queryNamedAdapter = hookable(queryNamedAdapter)
-
 def interfaceAdapterHook(iface, ob):
     try:
         adapters = getService(Adapters)
@@ -209,7 +179,7 @@
         #              DeprecationWarning, warningLevel())
         return None
 
-    return adapters.queryNamedAdapter(ob, iface, '')
+    return adapters.queryAdapter(ob, iface, '')
 
 from zope.interface.interface import adapter_hooks
 adapter_hooks.append(interfaceAdapterHook)

Modified: Zope3/trunk/src/zope/component/adapter.py
===================================================================
--- Zope3/trunk/src/zope/component/adapter.py	2004-06-02 01:58:30 UTC (rev 25168)
+++ Zope3/trunk/src/zope/component/adapter.py	2004-06-02 03:47:07 UTC (rev 25169)
@@ -58,10 +58,7 @@
 
     implements(IAdapterService)
 
-    def queryAdapter(self, object, interface, default=None):
-        return self.queryNamedAdapter(object, interface, '', default)
-
-    def queryNamedAdapter(self, object, interface, name='', default=None):
+    def queryAdapter(self, object, interface, name='', default=None):
         factory = self.lookup1(providedBy(object), interface, name)
         if factory is not None:
             return factory(object)

Modified: Zope3/trunk/src/zope/component/interfaces.py
===================================================================
--- Zope3/trunk/src/zope/component/interfaces.py	2004-06-02 01:58:30 UTC (rev 25168)
+++ Zope3/trunk/src/zope/component/interfaces.py	2004-06-02 03:47:07 UTC (rev 25169)
@@ -82,7 +82,7 @@
         ComponentLookupError.
         """
 
-    def queryUtility(interface, default=None, name='', context=None):
+    def queryUtility(interface, name='', default=None, context=None):
         """Look for the utility that provides interface
 
         Returns the nearest utility to the context that implements
@@ -125,23 +125,6 @@
         returned.
         """
 
-    def getNamedAdapter(object, interface, name, context=None):
-        """Get a named adapter to an interface for an object
-
-        Returns a named adapter that can adapt object to interface.  If a
-        matching adapter cannot be found, raises ComponentLookupError.
-
-        If context is None, an application-defined policy is used to choose
-        an appropriate service manager from which to get an 'Adapters' service.
-
-        If 'context' is not None, context is adapted to IServiceService,
-        and this adapter's 'Adapters' service is used.
-
-        The name consisting of an empty string is reserved for unnamed
-        adapters. The unnamed adapter methods will often call the
-        named adapter methods with an empty string for a name.
-        """
-
     def getMultiAdapter(objects, interface, name='', context=None):
         """Look for a multi-adapter to an interface for an objects
 
@@ -178,25 +161,6 @@
         returned.
         """
 
-    def queryNamedAdapter(object, interface, name, default=None,
-                          context=None):
-        """Look for a named adapter to an interface for an object
-
-        Returns a named adapter that can adapt object to interface.  If a
-        matching adapter cannot be found, returns the default.
-
-        If context is None, an application-defined policy is used to choose
-        an appropriate service manager from which to get an 'Adapters'
-        service.
-
-        If 'context' is not None, context is adapted to IServiceService,
-        and this adapter's 'Adapters' service is used.
-
-        The name consisting of an empty string is reserved for unnamed
-        adapters. The unnamed adapter methods will often call the
-        named adapter methods with an empty string for a name.
-        """
-
     def queryMultiAdapter(objects, interface, name='', default=None,
                           context=None):
         """Look for a multi-adapter to an interface for objects
@@ -417,13 +381,7 @@
         Raises ComponentLookupError if the service can't be found.
         """
 
-    def queryService(name, default=None):
-        """Look for a named service.
 
-        Return the default if the service can't be found.
-        """
-
-
 class IFactory(Interface):
     """A factory is responsible for creating other components."""
 
@@ -453,7 +411,7 @@
         If one is not found, raises ComponentLookupError.
         """
 
-    def queryUtility(interface, default=None, name=''):
+    def queryUtility(interface, name='', default=None):
         """Look up a utility that provides an interface.
 
         If one is not found, returns default.
@@ -493,13 +451,7 @@
 class IAdapterService(Interface):
     """A service to manage Adapters."""
 
-    def queryAdapter(object, interface, default=None):
-        """Look for an adapter to an interface for an object
-
-        If a matching adapter cannot be found, returns the default.
-        """
-
-    def queryNamedAdapter(object, interface, name, default=None):
+    def queryAdapter(object, interface, name='', default=None):
         """Look for a named adapter to an interface for an object
 
         If a matching adapter cannot be found, returns the default.
@@ -509,7 +461,7 @@
         named adapter methods with an empty string for a name.
         """
 
-    def queryMultiAdapter(objects, interface, name, default=None):
+    def queryMultiAdapter(objects, interface, name='', default=None):
         """Look for a multi-adapter to an interface for an object
 
         If a matching adapter cannot be found, returns the default.

Modified: Zope3/trunk/src/zope/component/presentation.py
===================================================================
--- Zope3/trunk/src/zope/component/presentation.py	2004-06-02 01:58:30 UTC (rev 25168)
+++ Zope3/trunk/src/zope/component/presentation.py	2004-06-02 03:47:07 UTC (rev 25169)
@@ -384,7 +384,7 @@
         """
         skin = request.getPresentationSkin() or self.defaultSkin
         for layer in self._skins[skin]:
-            r = layer.queryNamedAdapter(request, providing, name)
+            r = layer.queryAdapter(request, providing, name)
             if r is not None:
                 return r
         return default
@@ -471,13 +471,13 @@
 
 class Layer(zope.interface.adapter.AdapterRegistry):
 
-    def queryNamedAdapter(self, obj, interface, name, default=None):
+    def queryAdapter(self, obj, interface, name='', default=None):
         factory = self.lookup1(providedBy(obj), interface, name)
         if factory is not None:
             return factory(obj)
         return default
 
-    def queryMultiAdapter(self, objects, interface, name, default=None):
+    def queryMultiAdapter(self, objects, interface, name='', default=None):
         factory = self.lookup(map(providedBy, objects), interface, name)
         if factory is not None:
             return factory(*objects)

Modified: Zope3/trunk/src/zope/component/service.py
===================================================================
--- Zope3/trunk/src/zope/component/service.py	2004-06-02 01:58:30 UTC (rev 25168)
+++ Zope3/trunk/src/zope/component/service.py	2004-06-02 03:47:07 UTC (rev 25169)
@@ -104,18 +104,13 @@
 
     def getService(self, name):
         """see IServiceService interface"""
-        service = self.queryService(name)
+        service = self.__services.get(name)
         if service is None:
             raise ComponentLookupError(name)
 
         return service
 
-    def queryService(self, name, default=None):
-        """see IServiceService interface"""
 
-        return self.__services.get(name, default)
-
-
 def GS(service_manager, service_name):
     return service_manager.getService(service_name)
 

Modified: Zope3/trunk/src/zope/component/tests/test_api.py
===================================================================
--- Zope3/trunk/src/zope/component/tests/test_api.py	2004-06-02 01:58:30 UTC (rev 25168)
+++ Zope3/trunk/src/zope/component/tests/test_api.py	2004-06-02 03:47:07 UTC (rev 25169)
@@ -17,7 +17,6 @@
 from zope import component
 from zope.component import servicenames
 from zope.component import getAdapter, queryAdapter
-from zope.component import getNamedAdapter, queryNamedAdapter
 from zope.component import getService
 from zope.component import getUtility, queryUtility
 from zope.component import getDefaultViewName
@@ -169,15 +168,15 @@
         self.assertRaises(ComponentLookupError, getAdapter, Conforming, I2)
 
         # ...otherwise, you get the default
-        self.assertEquals(queryAdapter(ob, I2, Test), Test)
+        self.assertEquals(queryAdapter(ob, I2, '', Test), Test)
 
         # ...otherwise, you get the default
-        self.assertEquals(queryAdapter(Conforming, I2, Test), Test)
+        self.assertEquals(queryAdapter(Conforming, I2, '', Test), Test)
 
         # ...otherwise, you get the default
-        self.assertEquals(queryAdapter(Conforming, I3, Test), Test)
+        self.assertEquals(queryAdapter(Conforming, I3, '', Test), Test)
 
-        getService(None, Adapters).register([I1], I2, '', Comp)
+        getService(Adapters).register([I1], I2, '', Comp)
         c = getAdapter(ob, I2)
         self.assertEquals(c.__class__, Comp)
         self.assertEquals(c.context, ob)
@@ -196,15 +195,15 @@
         self.assertRaises(ComponentLookupError, getAdapter, ob, I2)
 
         # ...otherwise, you get the default
-        self.assertEquals(queryAdapter(ob, I2, Test), Test)
+        self.assertEquals(queryAdapter(ob, I2, '', Test), Test)
 
-        getService(None, Adapters).register([I1], I2, '', Comp)
+        getService(Adapters).register([I1], I2, '', Comp)
         c = getAdapter(ob, I2)
         self.assertEquals(c.__class__, Comp)
         self.assertEquals(c.context, ob)
 
     def testInterfaceCall(self):
-        getService(None, Adapters).register([I1], I2, '', Comp)
+        getService(Adapters).register([I1], I2, '', Comp)
         c = I2(ob)
         self.assertEquals(c.__class__, Comp)
         self.assertEquals(c.context, ob)
@@ -223,9 +222,9 @@
                           context=ob)
 
         # ...otherwise, you get the default
-        self.assertEquals(queryAdapter(ob, I2, Test, context=ob), Test)
+        self.assertEquals(queryAdapter(ob, I2, '', Test, context=ob), Test)
 
-        getService(None, Adapters).register([I1], I2, '', Comp)
+        getService(Adapters).register([I1], I2, '', Comp)
         c = getAdapter(ob, I2, context=ob)
         self.assertEquals(c.__class__, Comp)
         self.assertEquals(c.context, ob)
@@ -233,24 +232,17 @@
     def testNamedAdapter(self):
         self.testAdapter()
 
-        # If an object implements the interface you want to adapt to,
-        # getAdapter should simply return the object UNLESS we are asking for a
-        # named adapter.
-        self.assertRaises(ComponentLookupError,
-                          getNamedAdapter, ob, I1, 'test')
-
         # If an adapter isn't registered for the given object and interface,
         # and you provide no default, raise ComponentLookupError...
-        self.assertRaises(ComponentLookupError,
-                          getNamedAdapter, ob, I2, 'test')
+        self.assertRaises(ComponentLookupError, getAdapter, ob, I2, 'test')
 
         # ...otherwise, you get the default
-        self.assertEquals(queryNamedAdapter(ob, I2, 'test', Test), Test)
+        self.assertEquals(queryAdapter(ob, I2, 'test', Test), Test)
 
         class Comp2(Comp): pass
 
-        getService(None, Adapters).register([I1], I2, 'test', Comp2)
-        c = getNamedAdapter(ob, I2, 'test')
+        getService(Adapters).register([I1], I2, 'test', Comp2)
+        c = getAdapter(ob, I2, 'test')
         self.assertEquals(c.__class__, Comp2)
         self.assertEquals(c.context, ob)
 
@@ -265,7 +257,7 @@
             implements(I2)
         ob2 = Ob2()
         context = None
-        getService(context, Adapters).register([I1, I2], I3, '', DoubleAdapter)
+        getService(Adapters, context).register([I1, I2], I3, '', DoubleAdapter)
         c = queryMultiAdapter((ob, ob2), I3, context=context)
         self.assertEquals(c.__class__, DoubleAdapter)
         self.assertEquals(c.first, ob)
@@ -275,7 +267,7 @@
 
         # providing an adapter for None says that your adapter can
         # adapt anything to I2.
-        getService(None, Adapters).register([None], I2, '', Comp)
+        getService(Adapters).register([None], I2, '', Comp)
         c = getAdapter(ob, I2)
         self.assertEquals(c.__class__, Comp)
         self.assertEquals(c.context, ob)
@@ -283,9 +275,9 @@
     def testUtility(self):
         self.assertRaises(ComponentLookupError, getUtility, I1, context=ob)
         self.assertRaises(ComponentLookupError, getUtility, I2, context=ob)
-        self.assertEquals(queryUtility(I2, Test, context=ob), Test)
+        self.assertEquals(queryUtility(I2, default=Test, context=ob), Test)
 
-        getService(None, 'Utilities').provideUtility(I2, comp)
+        getService('Utilities').provideUtility(I2, comp)
         self.assertEquals(id(getUtility(I2, context=ob)), id(comp))
 
     def testNamedUtility(self):
@@ -299,10 +291,10 @@
                           getUtility, I1, 'test', context=ob)
         self.assertRaises(ComponentLookupError,
                           getUtility, I2, 'test', context=ob)
-        self.assertEquals(queryUtility(I2, Test, name='test', context=ob),
+        self.assertEquals(queryUtility(I2, 'test', Test, context=ob),
                           Test)
 
-        getService(None, 'Utilities').provideUtility(I2, comp, 'test')
+        getService('Utilities').provideUtility(I2, comp, 'test')
         self.assertEquals(id(getUtility(I2, 'test', ob)), id(comp))
 
     def test_getAllUtilitiesRegisteredFor(self):
@@ -315,10 +307,10 @@
         comp21 = Comp21('21')
         comp21bob = Comp21('21bob')
         
-        getService(None, 'Utilities').provideUtility(I2, comp)
-        getService(None, 'Utilities').provideUtility(I21, comp21)
-        getService(None, 'Utilities').provideUtility(I2, compbob, 'bob')
-        getService(None, 'Utilities').provideUtility(I21, comp21bob, 'bob')
+        getService('Utilities').provideUtility(I2, comp)
+        getService('Utilities').provideUtility(I21, comp21)
+        getService('Utilities').provideUtility(I2, compbob, 'bob')
+        getService('Utilities').provideUtility(I21, comp21bob, 'bob')
 
         comps = [comp, compbob, comp21, comp21bob]
         comps.sort()
@@ -341,7 +333,7 @@
                           getView, ob, 'foo', Request(I2))
         self.assertEquals(queryView(ob, 'foo', Request(I2), Test), Test)
 
-        getService(None, servicenames.Presentation).provideView(
+        getService(servicenames.Presentation).provideView(
             I1, 'foo', I2, Comp)
         c = getView(ob, 'foo', Request(I2))
         self.assertEquals(c.__class__, Comp)
@@ -367,7 +359,7 @@
             queryView(ob, 'foo', Request(I2), Test, providing=I3),
             Test)
 
-        getService(None, servicenames.Presentation).provideView(
+        getService(servicenames.Presentation).provideView(
             I1, 'foo', I2, Comp)
 
         self.assertRaises(ComponentLookupError,
@@ -379,7 +371,7 @@
             Test)
 
 
-        getService(None, servicenames.Presentation).provideView(
+        getService(servicenames.Presentation).provideView(
             I1, 'foo', I2, Comp, providing=I3)
 
         c = getView(ob, 'foo', Request(I2), providing=I3)
@@ -408,7 +400,7 @@
         self.assertEquals(
             queryMultiView((ob, ob2), request, I3, 'foo', 42), 42)
 
-        getService(None, servicenames.Presentation).provideAdapter(
+        getService(servicenames.Presentation).provideAdapter(
             IRequest, MV, 'foo', (I1, I2), I3)
 
         view = queryMultiView((ob, ob2), request, I3, 'foo')
@@ -464,7 +456,7 @@
         self.assertRaises(ComponentLookupError, getResource, 'foo', r2)
         self.assertEquals(queryResource('foo', r2, Test), Test)
 
-        getService(None, servicenames.Presentation).provideResource(
+        getService(servicenames.Presentation).provideResource(
             'foo', I2, Comp)
         c = getResource('foo', r2)
         self.assertEquals(c.__class__, Comp)
@@ -490,7 +482,7 @@
         self.assertEquals(queryResource('foo', r2, Test, providing=I3),
                           Test)
 
-        getService(None, servicenames.Presentation).provideResource(
+        getService(servicenames.Presentation).provideResource(
             'foo', I2, Comp)
 
         self.assertRaises(ComponentLookupError,
@@ -501,7 +493,7 @@
                           Test)
 
 
-        getService(None, servicenames.Presentation).provideResource(
+        getService(servicenames.Presentation).provideResource(
             'foo', I2, Comp, providing=I3)
 
         c = getResource('foo', r2, providing=I3)
@@ -522,7 +514,7 @@
         self.assertEquals(queryView(ob, 'foo', Request(I2), Test, context=ob),
                           Test)
 
-        getService(None, servicenames.Presentation).provideView(
+        getService(servicenames.Presentation).provideView(
             I1, 'foo', I2, Comp)
         c = getView(ob, 'foo', Request(I2), context=ob)
         self.assertEquals(c.__class__, Comp)
@@ -543,7 +535,7 @@
     def testDefaultViewName(self):
         from zope.component import getService
         from zope.exceptions import NotFoundError
-        viewService = getService(None, servicenames.Presentation)
+        viewService = getService(servicenames.Presentation)
         self.assertRaises(NotFoundError,
                           getDefaultViewName,
                           ob, Request(I1))

Modified: Zope3/trunk/src/zope/component/tests/test_factory.py
===================================================================
--- Zope3/trunk/src/zope/component/tests/test_factory.py	2004-06-02 01:58:30 UTC (rev 25168)
+++ Zope3/trunk/src/zope/component/tests/test_factory.py	2004-06-02 03:47:07 UTC (rev 25169)
@@ -66,7 +66,7 @@
     def setUp(self):
         super(TestFactoryZAPIFunctions, self).setUp()
         self.factory = Factory(Klass, 'Klass', 'Klassier')
-        utilityService = getService(None, servicenames.Utilities)
+        utilityService = getService(servicenames.Utilities)
         utilityService.provideUtility(IFactory, self.factory, 'klass')
 
     def testCreateObject(self):

Modified: Zope3/trunk/src/zope/component/tests/test_service.py
===================================================================
--- Zope3/trunk/src/zope/component/tests/test_service.py	2004-06-02 01:58:30 UTC (rev 25168)
+++ Zope3/trunk/src/zope/component/tests/test_service.py	2004-06-02 03:47:07 UTC (rev 25169)
@@ -27,7 +27,6 @@
 from zope.component.service import UndefinedService, InvalidService
 from zope.component.service import GlobalServiceManager, GlobalService
 from zope.component.exceptions import ComponentLookupError
-from zope.component import queryService
 from zope.component.interfaces import IServiceService
 
 class IOne(Interface):
@@ -49,11 +48,10 @@
         ss.defineService('one', IOne)
         c = ServiceOne()
         ss.provideService('one', c)
-        self.assertEqual(id(getService(None, 'one')), id(c))
+        self.assertEqual(id(getService('one')), id(c))
 
     def testFailedLookup(self):
-        self.assertRaises(ComponentLookupError, getService, None, 'two')
-        self.assertEqual(queryService(None, 'two'), None)
+        self.assertRaises(ComponentLookupError, getService, 'two')
 
     def testDup(self):
         getGlobalServices().defineService('one', IOne)
@@ -69,7 +67,7 @@
                           getGlobalServices().provideService,
                           'one', c2)
 
-        self.assertEqual(id(getService(None, 'one')), id(c))
+        self.assertEqual(id(getService('one')), id(c))
 
 
     def testUndefined(self):
@@ -104,7 +102,7 @@
         sm.defineService('two', ITwo)
         d = ServiceTwo()
         sm.provideService('two', d)
-        defs = getServiceDefinitions(None)
+        defs = getServiceDefinitions()
         defs.sort()
         self.assertEqual(defs,
             [('Services', IServiceService), ('one', IOne), ('two', ITwo)])

Modified: Zope3/trunk/src/zope/component/tests/test_utilityservice.py
===================================================================
--- Zope3/trunk/src/zope/component/tests/test_utilityservice.py	2004-06-02 01:58:30 UTC (rev 25168)
+++ Zope3/trunk/src/zope/component/tests/test_utilityservice.py	2004-06-02 03:47:07 UTC (rev 25169)
@@ -64,21 +64,21 @@
         provideService('Utilities', GlobalUtilityService())
 
     def testGetUtility(self):
-        us = getService(None, Utilities)
+        us = getService(Utilities)
         self.assertRaises(
             ComponentLookupError, getUtility, IDummyUtility)
         us.provideUtility(IDummyUtility, dummyUtility)
         self.assertEqual(getUtility(IDummyUtility), dummyUtility)
 
     def testQueryUtility(self):
-        us = getService(None, Utilities)
+        us = getService(Utilities)
         self.assertEqual(queryUtility(IDummyUtility), None)
         self.assertEqual(queryUtility(IDummyUtility, default=self), self)
         us.provideUtility(IDummyUtility, dummyUtility)
         self.assertEqual(queryUtility(IDummyUtility), dummyUtility)
 
     def testgetUtilitiesFor(self):
-        us = getService(None, Utilities)
+        us = getService(Utilities)
         us.provideUtility(IDummyUtility, dummyUtility)
         self.assertEqual(list(getUtilitiesFor(IDummyUtility)),
                          [('',dummyUtility)])
@@ -86,14 +86,14 @@
                          [('',dummyUtility)])
 
     def testregistrations(self):
-        us = getService(None, Utilities)
+        us = getService(Utilities)
         us.provideUtility(IDummyUtility, dummyUtility)
         self.assertEqual(
             map(str, us.registrations()),
             ["UtilityRegistration('IDummyUtility', '', 'DummyUtility', '')"])
 
     def testOverrides(self):
-        us = getService(None, Utilities)
+        us = getService(Utilities)
 
         # fail if nothing registered:
         self.assertRaises(

Modified: Zope3/trunk/src/zope/component/utility.py
===================================================================
--- Zope3/trunk/src/zope/component/utility.py	2004-06-02 01:58:30 UTC (rev 25168)
+++ Zope3/trunk/src/zope/component/utility.py	2004-06-02 03:47:07 UTC (rev 25169)
@@ -38,12 +38,12 @@
 
     def getUtility(self, interface, name=''):
         """See IUtilityService interface"""
-        c = self.queryUtility(interface, None, name)
+        c = self.queryUtility(interface, name)
         if c is not None:
             return c
         raise ComponentLookupError(interface, name)
 
-    def queryUtility(self, interface, default=None, name=''):
+    def queryUtility(self, interface, name='', default=None):
         """See IUtilityService interface"""
 
         byname = self._null.get(interface)

Modified: Zope3/trunk/src/zope/i18n/__init__.py
===================================================================
--- Zope3/trunk/src/zope/i18n/__init__.py	2004-06-02 01:58:30 UTC (rev 25168)
+++ Zope3/trunk/src/zope/i18n/__init__.py	2004-06-02 03:47:07 UTC (rev 25169)
@@ -41,7 +41,7 @@
         default = msgid.default
         mapping = msgid.mapping
 
-    util = queryUtility(ITranslationDomain, name=domain)
+    util = queryUtility(ITranslationDomain, domain)
 
     if util is None:
         return interpolate(default, mapping)

Modified: Zope3/trunk/src/zope/i18n/tests/test_itranslationdomain.py
===================================================================
--- Zope3/trunk/src/zope/i18n/tests/test_itranslationdomain.py	2004-06-02 01:58:30 UTC (rev 25168)
+++ Zope3/trunk/src/zope/i18n/tests/test_itranslationdomain.py	2004-06-02 03:47:07 UTC (rev 25169)
@@ -52,7 +52,7 @@
         assert verifyObject(ITranslationDomain, self._domain)
 
         # Setup the negotiator utility
-        utilities = getService(None, Utilities)
+        utilities = getService(Utilities)
         utilities.provideUtility(INegotiator, negotiator)        
 
     def testSimpleTranslate(self):

Modified: Zope3/trunk/src/zope/server/http/tests/test_publisherserver.py
===================================================================
--- Zope3/trunk/src/zope/server/http/tests/test_publisherserver.py	2004-06-02 01:58:30 UTC (rev 25168)
+++ Zope3/trunk/src/zope/server/http/tests/test_publisherserver.py	2004-06-02 03:47:07 UTC (rev 25169)
@@ -92,7 +92,7 @@
 
     def setUp(self):
         super(Tests, self).setUp()
-        as = zope.component.getService(None, 'Adapters')
+        as = zope.component.getService('Adapters')
         as.register([IHTTPRequest], IUserPreferredCharsets, '', HTTPCharsets)
         obj = tested_object()
         obj.folder = tested_object()




More information about the Zope3-Checkins mailing list