[Zope3-checkins] CVS: Zope3/lib/python/Zope/App/OFS/Services/ServiceManager - ConfigurationManager.py:1.2.10.2 IConfigurationManager.py:1.3.10.1 configure.zcml:1.8.10.2

Marius Gedminas mgedmin@codeworks.lt
Wed, 11 Dec 2002 10:14:04 -0500


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

Modified Files:
      Tag: named-component-configuration-branch
	ConfigurationManager.py IConfigurationManager.py 
	configure.zcml 
Log Message:
Bugfix: it used to be possible to delete a ConfigurationManager with active
or registered configurations without unregistering them


=== Zope3/lib/python/Zope/App/OFS/Services/ServiceManager/ConfigurationManager.py 1.2.10.1 => 1.2.10.2 ===
--- Zope3/lib/python/Zope/App/OFS/Services/ServiceManager/ConfigurationManager.py:1.2.10.1	Tue Dec 10 14:16:02 2002
+++ Zope3/lib/python/Zope/App/OFS/Services/ServiceManager/ConfigurationManager.py	Wed Dec 11 10:14:04 2002
@@ -19,6 +19,10 @@
 
 from Persistence import Persistent
 from IConfigurationManager import IConfigurationManager
+from Zope.App.OFS.Container.IDeleteNotifiable import IDeleteNotifiable
+from Zope.App.OFS.Container.IZopeContainer import IZopeWriteContainer
+from Zope.ComponentArchitecture import getAdapter
+
 
 class ConfigurationManager(Persistent):
     """Configuration manager
@@ -26,7 +30,7 @@
     Manages configurations within a package.
     """
 
-    __implements__ = IConfigurationManager
+    __implements__ = IConfigurationManager, IDeleteNotifiable
 
     def __init__(self):
         self._data = ()
@@ -135,6 +139,11 @@
     def moveDown(self, names):
         self._moveUpOrDown(names, 1)
 
+    def manage_beforeDelete(self, object, container):
+        assert object == self
+        container = getAdapter(object, IZopeWriteContainer)
+        for k, v in self._data:
+            del container[k]
 
 
 __doc__ = ConfigurationManager.__doc__  + __doc__


=== Zope3/lib/python/Zope/App/OFS/Services/ServiceManager/IConfigurationManager.py 1.3 => 1.3.10.1 ===
--- Zope3/lib/python/Zope/App/OFS/Services/ServiceManager/IConfigurationManager.py:1.3	Sun Dec  1 05:28:22 2002
+++ Zope3/lib/python/Zope/App/OFS/Services/ServiceManager/IConfigurationManager.py	Wed Dec 11 10:14:04 2002
@@ -21,7 +21,7 @@
 class IOrderedContainer(Interface):
     """Container with items that can be rearranged.
     """
-    
+
     # Yes, maybe this should be in the container package, but, we are
     # likely to come up with a better general ordering interface, so
     # we'll leave this one here for now.


=== Zope3/lib/python/Zope/App/OFS/Services/ServiceManager/configure.zcml 1.8.10.1 => 1.8.10.2 ===
--- Zope3/lib/python/Zope/App/OFS/Services/ServiceManager/configure.zcml:1.8.10.1	Tue Dec 10 14:16:02 2002
+++ Zope3/lib/python/Zope/App/OFS/Services/ServiceManager/configure.zcml	Wed Dec 11 10:14:04 2002
@@ -46,6 +46,9 @@
     <require
         permission="Zope.ManageServices"
         interface=".IConfigurationManager.IOrderedContainer" />
+    <require
+        permission="Zope.ManageServices"
+        interface="Zope.App.OFS.Container.IDeleteNotifiable." />
     <factory
         id = "Zope.App.OFS.Services.ServiceManager.ConfigurationManager"
         permission = "Zope.ManageServices"