[Zope3-checkins] CVS: Zope3/src/zope/app/services - folder.py:1.2

Jim Fulton jim@zope.com
Sun, 23 Mar 2003 12:14:13 -0500


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

Modified Files:
	folder.py 
Log Message:
added a site-management folder api to get the conguration manager

=== Zope3/src/zope/app/services/folder.py 1.1 => 1.2 ===
--- Zope3/src/zope/app/services/folder.py:1.1	Sun Mar 23 11:45:44 2003
+++ Zope3/src/zope/app/services/folder.py	Sun Mar 23 12:13:42 2003
@@ -27,6 +27,7 @@
 from zope.app.services.configuration import ConfigurationManager
 from zope.app.traversing import getPath
 from zope.proxy.context import ContextMethod, ContextWrapper
+from zope.app.interfaces.services.configuration import IConfigurationManager
 
 class SiteManagementFolder(BTreeContainer):
     __implements__ = ISiteManagementFolder
@@ -34,6 +35,21 @@
     def __init__(self):
         super(SiteManagementFolder, self).__init__()
         self.setObject('configure', ConfigurationManager())
+
+    def getConfigurationManager(self):
+        """Get a configuration manager
+        """
+
+        # Get the configuration manager for this folder
+        for name in self:
+            item = self[name]
+            if IConfigurationManager.isImplementedBy(item):
+                # We found one. Get it in context
+                return ContextWrapper(item, self, name=name)
+        else:
+            raise SystemError("Couldn't find an configuration manager")
+    
+
 
 class SiteManagementFolders(BTreeContainer):
     __implements__ = ISiteManagementFolders