[Zope3-checkins] CVS: Zope3/src/zope/app/services - configuration.py:1.12 configure.zcml:1.20 service.py:1.13 view.py:1.11
Jim Fulton
jim@zope.com
Tue, 18 Mar 2003 16:02:53 -0500
Update of /cvs-repository/Zope3/src/zope/app/services
In directory cvs.zope.org:/tmp/cvs-serv21177/src/zope/app/services
Modified Files:
configuration.py configure.zcml service.py view.py
Log Message:
Removed "Packages" from the object hierarchy in site managers (service
managers). We now traverse directly from site managers to individual
site-management folders.
This change is backward compatible because the underlying data
structures haven't changed.
=== Zope3/src/zope/app/services/configuration.py 1.11 => 1.12 ===
--- Zope3/src/zope/app/services/configuration.py:1.11 Wed Mar 12 13:48:31 2003
+++ Zope3/src/zope/app/services/configuration.py Tue Mar 18 16:02:22 2003
@@ -110,7 +110,7 @@
def _id(self, ob):
# Get and check relative path
- prefix = "/++etc++Services/Packages/"
+ prefix = "/++etc++Services/"
path = getPhysicalPathString(ob)
lpackages = path.rfind(prefix)
if lpackages < 0:
@@ -180,7 +180,7 @@
else:
# We need to deactivate the currently active component
sm = getServiceManager(wrapped_self)
- old = traverse(sm, 'Packages/'+data[0])
+ old = traverse(sm, data[0])
old.deactivated()
@@ -221,7 +221,7 @@
if path is not None:
# Make sure we can traverse to it.
sm = getServiceManager(wrapped_self)
- configuration = traverse(sm, 'Packages/'+path)
+ configuration = traverse(sm, path)
return configuration
return None
@@ -235,7 +235,7 @@
result = [{'id': path,
'active': False,
- 'configuration': (path and traverse(sm, 'Packages/'+path))
+ 'configuration': (path and traverse(sm, path))
}
for path in wrapped_self._data
]
=== Zope3/src/zope/app/services/configure.zcml 1.19 => 1.20 ===
--- Zope3/src/zope/app/services/configure.zcml:1.19 Tue Mar 11 11:11:22 2003
+++ Zope3/src/zope/app/services/configure.zcml Tue Mar 18 16:02:22 2003
@@ -204,7 +204,8 @@
interface="zope.app.interfaces.container.IReadContainer" />
<require
permission="zope.ManageServices"
- interface="zope.app.interfaces.services.service.IServiceManager" />
+ interface="zope.app.interfaces.services.service.IServiceManager
+ zope.app.interfaces.container.IWriteContainer" />
<implements
interface="zope.app.interfaces.annotation.IAttributeAnnotatable" />
</content>
@@ -302,7 +303,7 @@
<factory
id = "zope.app.services.ViewPackage"
permission = "zope.ManageServices"
- title = "View Package"
+ title = "View Folder"
/>
<require
permission="zope.View"
=== Zope3/src/zope/app/services/service.py 1.12 => 1.13 ===
--- Zope3/src/zope/app/services/service.py:1.12 Thu Mar 13 12:10:37 2003
+++ Zope3/src/zope/app/services/service.py Tue Mar 18 16:02:22 2003
@@ -43,7 +43,7 @@
from zope.app.component.nextservice import getNextService
from zope.app.component.nextservice import getNextServiceManager
-from zope.app.interfaces.container import IReadContainer
+from zope.app.interfaces.container import IContainer
from zope.app.interfaces.services.service import IBindingAware
from zope.app.interfaces.services.module import IModuleService
from zope.app.interfaces.services.service import IServiceConfiguration
@@ -65,7 +65,7 @@
class ServiceManager(PersistentModuleRegistry, NameComponentConfigurable):
- __implements__ = (IServiceManager, IReadContainer,
+ __implements__ = (IServiceManager, IContainer,
PersistentModuleRegistry.__implements__,
NameComponentConfigurable.__implements__,
IModuleService)
@@ -132,12 +132,32 @@
raise NameError(service_type)
getInterfaceFor = ContextMethod(getInterfaceFor)
- def queryComponent(wrapped_self, type=None, filter=None, all=0):
- Packages = ContextWrapper(wrapped_self.Packages, wrapped_self,
- name='Packages')
- return Packages.queryComponent(type, filter, all)
- queryComponent = ContextMethod(queryComponent)
+ def queryComponent(self, type=None, filter=None, all=0):
+ local = []
+ path = getPhysicalPathString(self)
+ for pkg_name in self:
+ package = ContextWrapper(self[pkg_name], self, name=pkg_name)
+ for name in package:
+ component = package[name]
+ if type is not None and not type.isImplementedBy(component):
+ continue
+ if filter is not None and not filter(component):
+ continue
+ wrapper = ContextWrapper(component, package, name=name)
+ local.append({'path': "%s/%s/%s" % (path, pkg_name, name),
+ 'component': wrapper,
+ })
+
+ if all:
+ next_service_manager = getNextServiceManager(self)
+ if IComponentManager.isImplementedBy(next_service_manager):
+ next_service_manager.queryComponent(type, filter, all)
+
+ local += list(all)
+ return local
+
+ queryComponent = ContextMethod(queryComponent)
# We provide a mapping interface for traversal, but we only expose
# local services through the mapping interface.
@@ -157,11 +177,7 @@
if key == 'Packages':
return wrapped_self.Packages
- service = wrapped_self.queryActiveComponent(key)
- if service is None:
- return default
-
- return service
+ return wrapped_self.Packages.get(key, default)
get = ContextMethod(get)
@@ -175,7 +191,7 @@
return iter(self.keys())
def keys(self):
- return ['Packages']
+ return self.Packages.keys()
def values(self):
return map(self.get, self.keys())
@@ -188,7 +204,10 @@
items = ContextMethod(items)
def __len__(self):
- return 1
+ return len(self.Packages)
+
+ def setObject(self, name, value):
+ return self.Packages.setObject(name, value)
def findModule(wrapped_self, name):
# override to pass call up to next service manager
=== Zope3/src/zope/app/services/view.py 1.10 => 1.11 ===
--- Zope3/src/zope/app/services/view.py:1.10 Tue Mar 11 11:11:22 2003
+++ Zope3/src/zope/app/services/view.py Tue Mar 18 16:02:22 2003
@@ -272,7 +272,7 @@
def implementationSummary(self):
L = []
if self.template:
- prefix = "/++etc++Services/Packages/"
+ prefix = "/++etc++Services/"
t = self.template
i = t.rfind(prefix)
if i >= 0: