[Zope3-checkins] CVS: Zope3/src/zope/app/services - adapter.py:1.18 cache.py:1.14 configuration.py:1.38 connection.py:1.14 service.py:1.25 utility.py:1.10 view.py:1.23

Guido van Rossum guido@python.org
Thu, 19 Jun 2003 17:56:16 -0400


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

Modified Files:
	adapter.py cache.py configuration.py connection.py service.py 
	utility.py view.py 
Log Message:
Add a simple string attribute (typically a class variable)
'serviceType' to the IConfiguration interface, so that the bundle code
can legally get at this information, which it needs to call that
service's queryConfigurationsFor() method.  Remove this info from the
ConfigurationStatusProperty class and constructor signature; this
class now gets this info from its configuration argument.



=== Zope3/src/zope/app/services/adapter.py 1.17 => 1.18 ===
--- Zope3/src/zope/app/services/adapter.py:1.17	Sat Jun  7 01:31:58 2003
+++ Zope3/src/zope/app/services/adapter.py	Thu Jun 19 17:55:45 2003
@@ -191,7 +191,9 @@
 
     implements(IAdapterConfiguration)
 
-    status = ConfigurationStatusProperty(Adapters)
+    serviceType = Adapters
+
+    status = ConfigurationStatusProperty()
 
     # XXX These should be positional arguments, except that forInterface
     #     isn't passed in if it is omitted. To fix this, we need a


=== Zope3/src/zope/app/services/cache.py 1.13 => 1.14 ===
--- Zope3/src/zope/app/services/cache.py:1.13	Wed Jun 11 15:24:22 2003
+++ Zope3/src/zope/app/services/cache.py	Thu Jun 19 17:55:45 2003
@@ -99,7 +99,9 @@
 
     implements(ICacheConfiguration)
 
-    status = ConfigurationStatusProperty('Caching')
+    serviceType = 'Caching'
+
+    status = ConfigurationStatusProperty()
 
     label = "Cache"
 


=== Zope3/src/zope/app/services/configuration.py 1.37 => 1.38 ===
--- Zope3/src/zope/app/services/configuration.py:1.37	Wed Jun 18 16:12:11 2003
+++ Zope3/src/zope/app/services/configuration.py	Thu Jun 19 17:55:45 2003
@@ -61,9 +61,6 @@
 
 class ConfigurationStatusProperty(ContextDescriptor):
 
-    def __init__(self, service):
-        self.service = service
-
     def __get__(self, inst, klass):
         if inst is None:
             return self
@@ -71,7 +68,7 @@
         configuration = inst
 
         sm = getServiceManager(configuration)
-        service = sm.queryLocalService(self.service)
+        service = sm.queryLocalService(configuration.serviceType)
         # XXX The following may fail; there's a subtle bug here when
         # the returned service isn't in the same service manager as
         # the one owning the configuration.
@@ -90,7 +87,7 @@
         configuration = inst
 
         sm = getServiceManager(configuration)
-        service = sm.queryLocalService(self.service)
+        service = sm.queryLocalService(configuration.serviceType)
 
         registry = service and service.queryConfigurationsFor(configuration)
 
@@ -104,7 +101,7 @@
                     "This configuration change cannot be performed because "
                     "there isn't a corresponding %s service defined in this "
                     "site. To proceed, first add a local %s service."
-                    % (self.service, self.service))
+                    % (configuration.serviceType, configuration.serviceType))
 
             if registry is None:
                 registry = service.createConfigurationsFor(configuration)


=== Zope3/src/zope/app/services/connection.py 1.13 => 1.14 ===
--- Zope3/src/zope/app/services/connection.py:1.13	Sat Jun  7 01:31:58 2003
+++ Zope3/src/zope/app/services/connection.py	Thu Jun 19 17:55:45 2003
@@ -83,7 +83,9 @@
 
     implements(IConnectionConfiguration)
 
-    status = ConfigurationStatusProperty('SQLDatabaseConnections')
+    serviceType = 'SQLDatabaseConnections'
+
+    status = ConfigurationStatusProperty()
 
     label = "Connection"
 


=== Zope3/src/zope/app/services/service.py 1.24 => 1.25 ===
--- Zope3/src/zope/app/services/service.py:1.24	Wed Jun 11 15:33:06 2003
+++ Zope3/src/zope/app/services/service.py	Thu Jun 19 17:55:45 2003
@@ -301,7 +301,9 @@
 
     implements(IServiceConfiguration)
 
-    status = ConfigurationStatusProperty('Services')
+    serviceType = 'Services'
+
+    status = ConfigurationStatusProperty()
 
     label = "Service"
 


=== Zope3/src/zope/app/services/utility.py 1.9 => 1.10 ===
--- Zope3/src/zope/app/services/utility.py:1.9	Fri Jun  6 12:34:53 2003
+++ Zope3/src/zope/app/services/utility.py	Thu Jun 19 17:55:45 2003
@@ -114,7 +114,9 @@
 
     """
 
-    status = ConfigurationStatusProperty('Utilities')
+    serviceType = 'Utilities'
+
+    status = ConfigurationStatusProperty()
 
     implements(IUtilityConfiguration)
 


=== Zope3/src/zope/app/services/view.py 1.22 => 1.23 ===
--- Zope3/src/zope/app/services/view.py:1.22	Sat Jun  7 01:31:59 2003
+++ Zope3/src/zope/app/services/view.py	Thu Jun 19 17:55:45 2003
@@ -219,7 +219,9 @@
 
     implements(IViewConfiguration)
 
-    status = ConfigurationStatusProperty('Views')
+    serviceType = 'Views'
+
+    status = ConfigurationStatusProperty()
 
     _what = "View" # For usageSummary(); subclass may override