[Zope3-checkins] CVS: Zope3/src/zope/app - copypastemove.py:1.15

Fred L. Drake, Jr. fred at zope.com
Fri Feb 20 11:56:47 EST 2004


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

Modified Files:
	copypastemove.py 
Log Message:


Fixed a bug that didn't surface until I fixed a bug in
Python's object.__reduce_ex__ implementation.



The copy test should have failed, as instances of classes created
in doctests aren't picklable.  I moved the class in question outside
the test.




=== Zope3/src/zope/app/copypastemove.py 1.14 => 1.15 ===
--- Zope3/src/zope/app/copypastemove.py:1.14	Thu Dec 11 07:06:10 2003
+++ Zope3/src/zope/app/copypastemove.py	Fri Feb 20 11:56:47 2004
@@ -18,6 +18,7 @@
 """
 
 from zope.app import zapi
+from zope.app.container.sample import SampleContainer
 from zope.app.event import publish
 from zope.app.event.objectevent import ObjectCopiedEvent
 from zope.app.i18n import ZopeMessageIDFactory as _
@@ -40,17 +41,10 @@
     The contained object should implement IContained.  It should be
     contained in a container that has an adapter to INameChooser.
 
-    >>> from zope.app.container.sample import SampleContainer
-    >>> class SampleContainer(SampleContainer):
-    ...     implements(INameChooser)
-    ...     def chooseName(self, name, ob):
-    ...        while name in self:
-    ...           name += '_'
-    ...        return name
 
     >>> from zope.app.container.contained import Contained
     >>> ob = Contained()
-    >>> container = SampleContainer()
+    >>> container = ExampleContainer()
     >>> container[u'foo'] = ob
     >>> mover = ObjectMover(ob)
 
@@ -64,7 +58,7 @@
     ask is whether we can move to a particular container. Right now,
     we can always move to a container of the same class:
 
-    >>> container2 = SampleContainer()
+    >>> container2 = ExampleContainer()
     >>> mover.moveableTo(container2)
     1
     >>> mover.moveableTo({})
@@ -225,17 +219,9 @@
     The contained object should implement IContained.  It should be
     contained in a container that has an adapter to INameChooser.
 
-    >>> from zope.app.container.sample import SampleContainer
-    >>> class SampleContainer(SampleContainer):
-    ...     implements(INameChooser)
-    ...     def chooseName(self, name, ob):
-    ...        while name in self:
-    ...           name += '_'
-    ...        return name
-
     >>> from zope.app.container.contained import Contained
     >>> ob = Contained()
-    >>> container = SampleContainer()
+    >>> container = ExampleContainer()
     >>> container[u'foo'] = ob
     >>> copier = ObjectCopier(ob)
 
@@ -249,7 +235,7 @@
     ask is whether we can copy to a particular container. Right now,
     we can always copy to a container of the same class:
 
-    >>> container2 = SampleContainer()
+    >>> container2 = ExampleContainer()
     >>> copier.copyableTo(container2)
     1
     >>> copier.copyableTo({})
@@ -459,3 +445,13 @@
 
     if mover.moveable() and mover.moveableTo(container, newid):
         mover.moveTo(container, newid)
+
+class ExampleContainer(SampleContainer):
+    # Sample container used for examples in doc stringss in this module
+
+    implements(INameChooser)
+
+    def chooseName(self, name, ob):
+       while name in self:
+          name += '_'
+       return name




More information about the Zope3-Checkins mailing list