[Zope3-checkins] CVS: Zope3/src/zope/app/services - service.py:1.5

Steve Alexander steve@cat-box.net
Wed, 8 Jan 2003 12:41:52 -0500


Update of /cvs-repository/Zope3/src/zope/app/services
In directory cvs.zope.org:/tmp/cvs-serv14977/src/zope/app/services

Modified Files:
	service.py 
Log Message:
reordered classes and imports so that

>>> from zope.app.services.service import ServiceManager

works on the python prompt.


=== Zope3/src/zope/app/services/service.py 1.4 => 1.5 ===
--- Zope3/src/zope/app/services/service.py:1.4	Mon Dec 30 07:50:27 2002
+++ Zope3/src/zope/app/services/service.py	Wed Jan  8 12:41:49 2003
@@ -49,15 +49,45 @@
 from zope.app.interfaces.services.service import IServiceManager
 from zope.app.interfaces.services.service import IServiceManagerContainer
 
+
+ModuleType = type(INameResolver)
+ModuleType = ModuleType, PersistentModule
+
+class ServiceManagerContainer:
+
+    __implements__ =  IServiceManagerContainer
+
+    def hasServiceManager(self):
+        '''See interface IReadServiceManagerContainer'''
+        return hasattr(self, '_ServiceManagerContainer__sm')
+
+    def getServiceManager(self):
+        '''See interface IReadServiceManagerContainer'''
+
+        try:
+            return self.__sm
+        except AttributeError:
+            raise ComponentLookupError('no service manager defined')
+
+    def queryServiceManager(self, default=None):
+        '''See interface IReadServiceManagerContainer'''
+
+        return getattr(self, '_ServiceManagerContainer__sm', default)
+
+    def setServiceManager(self, sm):
+        '''See interface IWriteServiceManagerContainer'''
+
+        if IServiceService.isImplementedBy(sm):
+            self.__sm = sm
+        else:
+            raise ValueError('setServiceManager requires an IServiceService')
+
+
 from zope.app.services.configuration import ConfigurationStatusProperty
 from zope.app.services.configuration import NameComponentConfigurable
 from zope.app.services.configuration import NamedComponentConfiguration
-
 from zope.app.services.package import Packages
 
-ModuleType = type(INameResolver)
-ModuleType = ModuleType, PersistentModule
-
 class ServiceManager(PersistentModuleRegistry, NameComponentConfigurable):
 
     __implements__ = (IServiceManager, IReadContainer,
@@ -275,33 +305,4 @@
             service.unbound(self.name)
 
     deactivated = ContextMethod(deactivated)
-
-class ServiceManagerContainer:
-
-    __implements__ =  IServiceManagerContainer
-
-    def hasServiceManager(self):
-        '''See interface IReadServiceManagerContainer'''
-        return hasattr(self, '_ServiceManagerContainer__sm')
-
-    def getServiceManager(self):
-        '''See interface IReadServiceManagerContainer'''
-
-        try:
-            return self.__sm
-        except AttributeError:
-            raise ComponentLookupError('no service manager defined')
-
-    def queryServiceManager(self, default=None):
-        '''See interface IReadServiceManagerContainer'''
-
-        return getattr(self, '_ServiceManagerContainer__sm', default)
-
-    def setServiceManager(self, sm):
-        '''See interface IWriteServiceManagerContainer'''
-
-        if IServiceService.isImplementedBy(sm):
-            self.__sm = sm
-        else:
-            raise ValueError('setServiceManager requires an IServiceService')