[Zope3-checkins] SVN: Zope3/trunk/src/zope/app/copypastemove/ The copyTo and moveTo methods in copypastemove return now the new name as described by the interface.

Uwe Oestermeier uwe_oestermeier at iwm-kmrc.de
Tue Oct 12 14:38:05 EDT 2004


Log message for revision 28027:
  The copyTo and moveTo methods in copypastemove return now the new name as described by the interface.


Changed:
  U   Zope3/trunk/src/zope/app/copypastemove/__init__.py
  U   Zope3/trunk/src/zope/app/copypastemove/interfaces.py


-=-
Modified: Zope3/trunk/src/zope/app/copypastemove/__init__.py
===================================================================
--- Zope3/trunk/src/zope/app/copypastemove/__init__.py	2004-10-12 18:36:23 UTC (rev 28026)
+++ Zope3/trunk/src/zope/app/copypastemove/__init__.py	2004-10-12 18:38:03 UTC (rev 28027)
@@ -66,6 +66,7 @@
     the mover to do so:
 
     >>> mover.moveTo(container2)
+    u'foo'
     >>> list(container)
     []
     >>> list(container2)
@@ -76,6 +77,7 @@
     We can also specify a name:
 
     >>> mover.moveTo(container2, u'bar')
+    u'bar'
     >>> list(container2)
     [u'bar']
     >>> ob.__parent__ is container2
@@ -88,6 +90,7 @@
 
     >>> container2[u'splat'] = 1
     >>> mover.moveTo(container2, u'splat')
+    u'splat_'
     >>> l = list(container2)
     >>> l.sort()
     >>> l
@@ -187,6 +190,7 @@
 
         target[new_name] = obj
         del container[orig_name]
+        return new_name
 
     def moveable(self):
         '''Returns ``True`` if the object is moveable, otherwise ``False``.'''
@@ -241,6 +245,7 @@
     the copier to do so:
 
     >>> copier.copyTo(container2)
+    u'foo'
     >>> list(container)
     [u'foo']
     >>> list(container2)
@@ -257,6 +262,7 @@
     We can also specify a name:
 
     >>> copier.copyTo(container2, u'bar')
+    u'bar'
     >>> l = list(container2)
     >>> l.sort()
     >>> l
@@ -275,6 +281,7 @@
     use:
 
     >>> copier.copyTo(container2, u'bar')
+    u'bar_'
     >>> l = list(container2)
     >>> l.sort()
     >>> l
@@ -352,8 +359,8 @@
     def copyTo(self, target, new_name=None):
         """Copy this object to the `target` given.
 
-        Returns the new name within the `target`, or ``None``
-        if the target doesn't do names.
+        Returns the new name within the `target`.
+        
         Typically, the `target` is adapted to `IPasteTarget`.
         After the copy is added to the `target` container, publish
         an `IObjectCopied` event in the context of the target container.
@@ -377,6 +384,7 @@
         notify(ObjectCopiedEvent(copy))
 
         target[new_name] = copy
+        return new_name
 
     def _configureCopy(self, copy, target, new_name):
         """Configures the copied object before it is added to `target`.

Modified: Zope3/trunk/src/zope/app/copypastemove/interfaces.py
===================================================================
--- Zope3/trunk/src/zope/app/copypastemove/interfaces.py	2004-10-12 18:36:23 UTC (rev 28026)
+++ Zope3/trunk/src/zope/app/copypastemove/interfaces.py	2004-10-12 18:38:03 UTC (rev 28027)
@@ -25,7 +25,7 @@
     def moveTo(target, new_name=None):
         '''Move this object to the target given.
 
-        Returns the new name within the target
+        Returns the new name within the target.
         Typically, the target is adapted to `IPasteTarget`.'''
 
     def moveable():
@@ -43,8 +43,7 @@
     def copyTo(target, new_name=None):
         """Copy this object to the `target` given.
 
-        Returns the new name within the `target`, or ``None``
-        if the target doesn't do names.
+        Returns the new name within the `target`.
         Typically, the target is adapted to `IPasteTarget`.
         After the copy is added to the target container, publish
         an `IObjectCopied` event in the context of the target container.



More information about the Zope3-Checkins mailing list