[Zope3-checkins] CVS: Zope3/lib/python/Zope/App/OFS/Services - Configuration.py:1.3.2.2

Marius Gedminas mgedmin@codeworks.lt
Wed, 11 Dec 2002 11:07:38 -0500


Update of /cvs-repository/Zope3/lib/python/Zope/App/OFS/Services
In directory cvs.zope.org:/tmp/cvs-serv29432/lib/python/Zope/App/OFS/Services

Modified Files:
      Tag: named-component-configuration-branch
	Configuration.py 
Log Message:
Bugfix for the following scenario:
  1. create and configure an SQLConnectionService
  2. create and configure a database adapter&connection
  3. disable the SQLConnectionService
  4. database connection configuration views stop working, and it is impossible
     to view ++etc++Services/Packages/default/configure/



=== Zope3/lib/python/Zope/App/OFS/Services/Configuration.py 1.3.2.1 => 1.3.2.2 ===
--- Zope3/lib/python/Zope/App/OFS/Services/Configuration.py:1.3.2.1	Tue Dec 10 14:15:59 2002
+++ Zope3/lib/python/Zope/App/OFS/Services/Configuration.py	Wed Dec 11 11:07:38 2002
@@ -26,7 +26,8 @@
 from ConfigurationInterfaces import INamedComponentConfiguration
 from ConfigurationInterfaces import INameConfigurable
 from Zope.Schema import Text
-from Zope.ComponentArchitecture import getService, getServiceManager
+from Zope.ComponentArchitecture import getService, queryService
+from Zope.ComponentArchitecture import getServiceManager
 from Zope.ComponentArchitecture import getAdapter
 from Zope.ContextWrapper import ContextMethod
 from Zope.Proxy.ContextWrapper import ContextWrapper
@@ -56,8 +57,8 @@
             return self
 
         configuration = inst
-        service = getService(configuration, self.service)
-        registry = service.queryConfigurationsFor(configuration)
+        service = queryService(configuration, self.service)
+        registry = service and service.queryConfigurationsFor(configuration)
 
         if registry:
 
@@ -70,14 +71,17 @@
 
     def __set__(self, inst, value):
         configuration = inst
-        service = getService(configuration, self.service)
-        registry = service.queryConfigurationsFor(configuration)
+        service = queryService(configuration, self.service)
+        registry = service and service.queryConfigurationsFor(configuration)
 
         if value == Unregistered:
             if registry:
                 registry.unregister(configuration)
 
         else:
+            if not service:
+                # raise an error
+                service = getService(configuration, self.service)
 
             if registry is None:
                 registry = service.createConfigurationsFor(configuration)