[Zope-Checkins] CVS: Zope3/lib/python/Zope/App/OFS/ServiceManager - ServiceManager.py:1.1.2.8 hooks.py:1.1.2.3
Jim Fulton
jim@zope.com
Sun, 28 Apr 2002 13:17:09 -0400
Update of /cvs-repository/Zope3/lib/python/Zope/App/OFS/ServiceManager
In directory cvs.zope.org:/tmp/cvs-serv17050/lib/python/Zope/App/OFS/ServiceManager
Modified Files:
Tag: Zope-3x-branch
ServiceManager.py hooks.py
Log Message:
HOTYB: Merged SecurityProxy-branch into main branch.
All tests pass and folders can be listed and added through the web.
It is likely that most other things don't work and will need to be
fixed. The reason is that many accesses that should have been checked
before are now being checked and additional checks and thinking about
permissions and security settings are needed.
I'm in the process of drafting a paper for the wiki that describes the
changes in more detail.
=== Zope3/lib/python/Zope/App/OFS/ServiceManager/ServiceManager.py 1.1.2.7 => 1.1.2.8 ===
from Zope.Exceptions import NotFoundError, ZopeError
from Zope.App.OFS.Folder.Folder import Folder
-from Zope.ContextWrapper import getinnercontext, Wrapper, ContextMethod
+from Zope.ContextWrapper import ContextMethod
+from Zope.Proxy.ContextWrapper import ContextWrapper
from Zope.App.OFS.Container.BTreeContainer import BTreeContainer
class ServiceManager(BTreeContainer):
@@ -62,8 +63,9 @@
service = wrapped_self.__bindings.get(name)
if service:
- return Wrapper(wrapped_self.getObject(service), wrapped_self, name=name)
- # we don't need to check security, do we?
+ return ContextWrapper(wrapped_self.getObject(service),
+ wrapped_self, name=name)
+ # XXX we don't need to check security, do we?
return getNextService(wrapped_self, name)
=== Zope3/lib/python/Zope/App/OFS/ServiceManager/hooks.py 1.1.2.2 => 1.1.2.3 ===
from Zope.ComponentArchitecture.IServiceService import IServiceService
from Zope.ComponentArchitecture.IServiceManagerContainer import IServiceManagerContainer
-from Zope.ContextWrapper import getinnercontext
+from Zope.Proxy.ContextWrapper import getWrapperContainer
from Zope.ComponentArchitecture import getGlobalServiceManager, \
getServiceManager
from Zope.ComponentArchitecture.Exceptions import ComponentLookupError
from Zope.ComponentArchitecture.Service import serviceManager
+from Zope.Proxy.ProxyIntrospection import removeAllProxies
def getServiceManager_hook(context):
"""
@@ -30,13 +31,15 @@
"""
while context is not None:
# if the context is actually a service or service manager...
- if IServiceService.isImplementedBy(context): return context
- if IServiceManagerContainer.isImplementedBy(context):
+ if IServiceService.isImplementedBy(removeAllProxies(context)):
+ return context
+ if IServiceManagerContainer.isImplementedBy(
+ removeAllProxies(context)):
try:
return context.getServiceManager()
except ComponentLookupError:
pass
- context = getinnercontext(context)
+ context = getWrapperContainer(context)
return getGlobalServiceManager()
def getNextServiceManager_hook(context):
@@ -44,10 +47,10 @@
to return the next highest service manager"""
context=getServiceManager(context)
if context is serviceManager: return None
- context=getinnercontext(context)
+ context=getWrapperContainer(context)
while context and not IServiceManagerContainer.isImplementedBy(context):
- context=getinnercontext(context) # we should be
+ context=getWrapperContainer(context) # we should be
# able to rely on the first step getting us a
# ServiceManagerContainer
- context=getinnercontext(context)
- return getServiceManager(context)
\ No newline at end of file
+ context=getWrapperContainer(context)
+ return getServiceManager(context)