[Zope3-checkins] CVS: Zope3/src/zope/app/services - utility.py:1.9
Steve Alexander
steve@cat-box.net
Fri, 6 Jun 2003 12:35:23 -0400
Update of /cvs-repository/Zope3/src/zope/app/services
In directory cvs.zope.org:/tmp/cvs-serv5043/src/zope/app/services
Modified Files:
utility.py
Log Message:
Removed use of ContextAware mixin class.
=== Zope3/src/zope/app/services/utility.py 1.8 => 1.9 ===
--- Zope3/src/zope/app/services/utility.py:1.8 Sun Jun 1 11:59:36 2003
+++ Zope3/src/zope/app/services/utility.py Fri Jun 6 12:34:53 2003
@@ -17,6 +17,7 @@
$Id$
"""
+from zope.interface import implements
from persistence.dict import PersistentDict
from persistence import Persistent
from zope.app.component.nextservice import getNextService
@@ -29,12 +30,12 @@
from zope.app.services.configuration import ComponentConfiguration
from zope.component.exceptions import ComponentLookupError
from zope.interface.implementor import ImplementorRegistry
-from zope.context import ContextAware
+from zope.context import ContextMethod
from zope.app.context import ContextWrapper
-class LocalUtilityService(Persistent, ContextAware):
+class LocalUtilityService(Persistent):
- __implements__ = ILocalUtilityService, IConfigurable, ISimpleService
+ implements(ILocalUtilityService, IConfigurable, ISimpleService)
def __init__(self):
self._utilities = PersistentDict()
@@ -44,6 +45,7 @@
if utility is None:
raise ComponentLookupError("utility", interface, name)
return utility
+ getUtility = ContextMethod(getUtility)
def queryUtility(self, interface, default=None, name=''):
registry = self.queryConfigurations(name, interface)
@@ -54,11 +56,13 @@
next = getNextService(self, "Utilities")
return next.queryUtility(interface, default, name)
+ queryUtility = ContextMethod(queryUtility)
def queryConfigurationsFor(self, configuration, default=None):
return self.queryConfigurations(configuration.name,
configuration.interface,
default)
+ queryConfigurationsFor = ContextMethod(queryConfigurationsFor)
def queryConfigurations(self, name, interface, default=None):
utilities = self._utilities.get(name)
@@ -69,11 +73,14 @@
return default
return ContextWrapper(registry, self)
+ queryConfigurations = ContextMethod(queryConfigurations)
def createConfigurationsFor(self, configuration):
return self.createConfigurations(configuration.name,
configuration.interface)
+ createConfigurationsFor = ContextMethod(createConfigurationsFor)
+
def createConfigurations(self, name, interface):
utilities = self._utilities.get(name)
if utilities is None:
@@ -86,6 +93,7 @@
utilities.register(interface, registry)
return ContextWrapper(registry, self)
+ createConfigurations = ContextMethod(createConfigurations)
def getRegisteredMatching(self):
L = []
@@ -95,6 +103,7 @@
continue
L.append((iface, name, ContextWrapper(cr, self)))
return L
+ getRegisteredMatching = ContextMethod(getRegisteredMatching)
class UtilityConfiguration(ComponentConfiguration):
@@ -107,8 +116,7 @@
status = ConfigurationStatusProperty('Utilities')
- __implements__ = (IUtilityConfiguration,
- ComponentConfiguration.__implements__)
+ implements(IUtilityConfiguration)
def __init__(self, name, interface, component_path, permission=None):
ComponentConfiguration.__init__(self, component_path, permission)