[Zope3-checkins] CVS: Zope3/src/zope/app/container - configure.zcml:1.16 zopecontainer.py:1.23

Steve Alexander steve@cat-box.net
Sun, 15 Jun 2003 12:38:59 -0400


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

Modified Files:
	configure.zcml zopecontainer.py 
Log Message:
Made ContainerSized depend on IReadContainer not IContainer.

Made ZopeItemWriteContainerDecorator, and IItemWriteContainer and
IZopeItemWriteContainer interfaces to express the dependency that
writing to a ZopeContainer has on IItemContainer.

Added zcml to make these different kinds of decorators work.


=== Zope3/src/zope/app/container/configure.zcml 1.15 => 1.16 ===
--- Zope3/src/zope/app/container/configure.zcml:1.15	Fri Jun 13 13:53:34 2003
+++ Zope3/src/zope/app/container/configure.zcml	Sun Jun 15 12:38:29 2003
@@ -30,6 +30,30 @@
       for="zope.app.interfaces.container.IReadContainer"
       />
 
+  <!-- Decorators for different flavours of container -->
+  <adapter
+      factory="zope.app.container.zopecontainer.ZopeItemContainerDecorator"
+      provides="zope.app.interfaces.context.IZopeContextWrapper"
+      for="zope.app.interfaces.container.IItemContainer"
+      />
+  <adapter
+      factory="
+      zope.app.container.zopecontainer.ZopeSimpleReadContainerDecorator"
+      provides="zope.app.interfaces.context.IZopeContextWrapper"
+      for="zope.app.interfaces.container.ISimpleReadContainer"
+      />
+  <adapter
+      factory="
+      zope.app.container.zopecontainer.ZopeReadContainerDecorator"
+      provides="zope.app.interfaces.context.IZopeContextWrapper"
+      for="zope.app.interfaces.container.IReadContainer"
+      />
+  <adapter
+      factory="
+      zope.app.container.zopecontainer.ZopeItemWriteContainerDecorator"
+      provides="zope.app.interfaces.context.IZopeContextWrapper"
+      for="zope.app.interfaces.container.IItemWriteContainer"
+      />
   <adapter
       factory="zope.app.container.zopecontainer.ZopeContainerDecorator"
       provides="zope.app.interfaces.context.IZopeContextWrapper"
@@ -49,7 +73,7 @@
   <adapter
       factory="zope.app.container.size.ContainerSized"
       provides="zope.app.interfaces.size.ISized"
-      for="zope.app.interfaces.container.IContainer"
+      for="zope.app.interfaces.container.IReadContainer"
       />
 
   <event:subscribe


=== Zope3/src/zope/app/container/zopecontainer.py 1.22 => 1.23 ===
--- Zope3/src/zope/app/container/zopecontainer.py:1.22	Sun Jun 15 12:10:43 2003
+++ Zope3/src/zope/app/container/zopecontainer.py	Sun Jun 15 12:38:29 2003
@@ -19,7 +19,7 @@
 
 from zope.app.interfaces.container import IZopeSimpleReadContainer
 from zope.app.interfaces.container import IZopeReadContainer
-from zope.app.interfaces.container import IZopeWriteContainer
+from zope.app.interfaces.container import IZopeItemWriteContainer
 from zope.app.interfaces.container import IZopeContainer
 from zope.app.interfaces.container import IOptionalNamesContainer
 from zope.app.interfaces.container import IContainerNamesContainer
@@ -100,11 +100,15 @@
         return result
 
 
-class ZopeWriteContainerDecorator(ZopeItemContainerDecorator):
-    # Both setObject and __delitem__ depend on the decorator having
-    # __getitem__
+class ZopeItemWriteContainerDecorator(ZopeItemContainerDecorator):
+    # Both 'setObject' and '__delitem__' depend on the decorator having
+    # '__getitem__'
+    #
+    # A ZopeWriteContainerDecorator could be written to work with other
+    # means for getting objects from a container. However, in most cases,
+    # IZopeWriteContainer depends on IItemContainer.
 
-    implements(IZopeWriteContainer)
+    implements(IZopeItemWriteContainer)
 
     def setObject(self, key, object):
         "See IZopeWriteContainer"
@@ -167,7 +171,7 @@
         return key
 
 
-class ZopeContainerDecorator(ZopeWriteContainerDecorator,
+class ZopeContainerDecorator(ZopeItemWriteContainerDecorator,
                              ZopeReadContainerDecorator):
     implements(IZopeContainer)