[Zope3-checkins] CVS: Zope3/src/zope/app/browser/container - contents.py:1.14

Sidnei da Silva sidnei@x3ng.com.br
Sun, 30 Mar 2003 10:41:28 -0500


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

Modified Files:
	contents.py 
Log Message:
Slight changes to IObjectCopier to allow copying without children. Its somewhat crufty, but I cant think of a better solution. Comes with tests :)

=== Zope3/src/zope/app/browser/container/contents.py 1.13 => 1.14 ===
--- Zope3/src/zope/app/browser/container/contents.py:1.13	Wed Mar 19 14:57:21 2003
+++ Zope3/src/zope/app/browser/container/contents.py	Sun Mar 30 10:40:57 2003
@@ -25,7 +25,7 @@
      import IPrincipalAnnotationService
 from zope.publisher.browser import BrowserView
 from zope.app.interfaces.traversing import IPhysicallyLocatable
-from zope.app.traversing import traverse, getRoot, getPath
+from zope.app.traversing import traverse, getRoot, getPath, joinPath
 from zope.app.interfaces.copypastemove import IPrincipalClipboard
 from zope.app.interfaces.container import IPasteTarget
 from zope.app.interfaces.copypastemove import IObjectCopier
@@ -95,7 +95,7 @@
         clipboard.clearContents()
         items = []
         for id in ids:
-            items.append('%s/%s' % (container_path, id))
+            items.append(joinPath(container_path, id))
         clipboard.addItems('copy', items)
 
         self.request.response.redirect('@@contents.html')
@@ -111,7 +111,7 @@
         clipboard.clearContents()
         items = []
         for id in ids:
-            items.append('%s/%s' % (container_path, id))
+            items.append(joinPath(container_path, id))
         clipboard.addItems('cut', items)
 
         self.request.response.redirect('@@contents.html')
@@ -119,8 +119,8 @@
     def pasteObjects(self):
         """Iterate over clipboard contents and perform the
            move/copy operations"""
-        container = self.context
-        target = container
+        root = getRoot(self.context)
+        target = self.context
 
         user = self.request.user
         annotationsvc = getService(self.context, 'PrincipalAnnotation')
@@ -128,7 +128,7 @@
         clipboard = getAdapter(annotations, IPrincipalClipboard)
         items = clipboard.getContents()
         for item in items:
-            obj = traverse(container, item['target'])
+            obj = traverse(target, item['target'])
             if item['action'] == 'cut':
                 getAdapter(obj, IObjectMover).moveTo(target)
                 # XXX need to remove the item from the clipboard here