[Zope3-checkins] CVS: Zope3/src/zope/app - copypastemove.py:1.10.24.6 location.py:1.1.2.9

Jim Fulton jim at zope.com
Mon Sep 15 14:12:56 EDT 2003


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

Modified Files:
      Tag: parentgeddon-branch
	copypastemove.py location.py 
Log Message:
Got lots of tests to pass.

Added a setitem helper function to be used to help satisfy container
contracts.



=== Zope3/src/zope/app/copypastemove.py 1.10.24.5 => 1.10.24.6 ===
--- Zope3/src/zope/app/copypastemove.py:1.10.24.5	Fri Sep 12 16:46:24 2003
+++ Zope3/src/zope/app/copypastemove.py	Mon Sep 15 14:12:25 2003
@@ -58,6 +58,10 @@
         if new_name is None:
             new_name = orig_name
 
+        if target is container and new_name == orig_name:
+            # Nothing to do
+            return
+
         chooser = zapi.getAdapter(target, INameChooser)
         new_name = chooser.chooseName(new_name, obj)
 
@@ -105,6 +109,7 @@
 
         copy = removeAllProxies(obj)
         cppy = locationCopy(copy)
+        copy.__parent__ = copy.__name__ = None
         publish(target, ObjectCopiedEvent(copy))
 
         target[new_name] = copy


=== Zope3/src/zope/app/location.py 1.1.2.8 => 1.1.2.9 ===
--- Zope3/src/zope/app/location.py:1.1.2.8	Fri Sep 12 15:15:05 2003
+++ Zope3/src/zope/app/location.py	Mon Sep 15 14:12:25 2003
@@ -441,11 +441,11 @@
 class LocationProxy(ProxyBase):
     """Contained-object proxy
 
-    This is a picklable proxy that can be put around objects that
-    don't implemeny IContained.
+    This is a non-picklable proxy that can be put around objects that
+    don't implemeny ILocation.
 
     >>> l = [1, 2, 3]
-    >>> p = ContainedProxy(l, "Dad", "p")
+    >>> p = LocationProxy(l, "Dad", "p")
     >>> p
     [1, 2, 3]
     >>> p.__parent__
@@ -454,13 +454,10 @@
     'p'
 
     >>> import pickle
-    >>> p2 = pickle.loads(pickle.dumps(p))
-    >>> p2
-    [1, 2, 3]
-    >>> p2.__parent__
-    'Dad'
-    >>> p2.__name__
-    'p'
+    >>> p2 = pickle.dumps(p)
+    Traceback (most recent call last):
+    ...
+    TypeError: Not picklable
     
     
     """




More information about the Zope3-Checkins mailing list