[Zope3-checkins] CVS: Zope3/src/zope/app/component/tests - placelesssetup.py:1.5.20.2

Steve Alexander steve@cat-box.net
Thu, 15 May 2003 10:49:58 -0400


Update of /cvs-repository/Zope3/src/zope/app/component/tests
In directory cvs.zope.org:/tmp/cvs-serv12712/src/zope/app/component/tests

Modified Files:
      Tag: stevea-decorators-branch
	placelesssetup.py 
Log Message:
More work on Decorators.
Converted existing tests to use decorators instead of ZopeContainerAdapter.


=== Zope3/src/zope/app/component/tests/placelesssetup.py 1.5.20.1 => 1.5.20.2 ===
--- Zope3/src/zope/app/component/tests/placelesssetup.py:1.5.20.1	Tue May 13 13:41:35 2003
+++ Zope3/src/zope/app/component/tests/placelesssetup.py	Thu May 15 10:49:27 2003
@@ -20,6 +20,11 @@
 from zope.app.services.servicenames import Interfaces
 from zope.app.interfaces.component import IInterfaceService
 from zope.app.component.globalinterfaceservice import interfaceService
+from zope.app.component.decoratorservice import registerDecorator
+from zope.app.component.decoratorservice import registerDecoratorForClass
+from zope.app.component.directiveswithperms import DecoratorSpec
+from zope.app.container.zopecontainer import ZopeContainerDecorator
+from zope.interface import implementedBy
 
 class PlacelessSetup:
 
@@ -31,3 +36,23 @@
 
         defineService(Interfaces, IInterfaceService)
         provideService(Interfaces, interfaceService)
+
+        spec = DecoratorSpec(
+          ZopeContainerDecorator,
+          implementedBy(ZopeContainerDecorator), 
+          "__getitem__ get values items setObject __delitem__ rename".split(),
+          {'rename':'zope.ManageContent'},
+          {},
+          True
+          )
+        registerDecorator('zope.app.container.contextdecorator', spec)
+        from zope.app.component.hooks import ContextWrapper_hook
+        import zope.proxy.context as contextmodule
+        contextmodule.ContextWrapper_hook = ContextWrapper_hook
+
+        from zope.app.content.folder import Folder, RootFolder
+        from zope.app.container.sample import SampleContainer
+        for cls in Folder, RootFolder, SampleContainer:
+            registerDecoratorForClass(cls,
+                                      'zope.app.container.contextdecorator',
+                                      'context')