[Zope3-checkins]
SVN: Zope3/trunk/src/zope/app/component/bbb/site.py
Changed queryLocalService to give Utilities and Adapters special
Jim Fulton
jim at zope.com
Tue Feb 15 20:12:24 EST 2005
Log message for revision 29155:
Changed queryLocalService to give Utilities and Adapters special
treatment. This makes calls to queryLocalService work when looking
for Utilities. Also changed it to return the default if lookup
fails.
There don't seem to be tests for the backward-compatibility code,
which, I guess, is OK.
Changed:
U Zope3/trunk/src/zope/app/component/bbb/site.py
-=-
Modified: Zope3/trunk/src/zope/app/component/bbb/site.py
===================================================================
--- Zope3/trunk/src/zope/app/component/bbb/site.py 2005-02-16 01:11:34 UTC (rev 29154)
+++ Zope3/trunk/src/zope/app/component/bbb/site.py 2005-02-16 01:12:24 UTC (rev 29155)
@@ -134,7 +134,11 @@
'The method will be gone in X3.3.')
def queryLocalService(self, name, default=None):
- service = zapi.getUtility(IService, name, self)
+ if name in _builtinServices:
+ return self
+ service = zapi.queryUtility(IService, name, self)
+ if service is None:
+ return default
if zapi.getSiteManager(service) is not self:
return default
return service
@@ -161,7 +165,9 @@
'This method was pretty useless even before services were gone! '
'The method will be gone in X3.3.')
+_builtinServices = ('Utilities', 'Adapters')
+
class BBBUtilityRegistration(object):
def provided(self):
More information about the Zope3-Checkins
mailing list