[Zope3-checkins] CVS: Zope3/src/zope/app/content - folder.py:1.10

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


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

Modified Files:
	folder.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/content/folder.py 1.9 => 1.10 ===
--- Zope3/src/zope/app/content/folder.py:1.9	Sun Mar 23 17:35:39 2003
+++ Zope3/src/zope/app/content/folder.py	Sun Mar 30 10:40:59 2003
@@ -14,7 +14,8 @@
 
 from persistence import Persistent
 from zodb.btrees.OOBTree import OOBTree
-from zope.app.interfaces.content.folder import IFolder, IRootFolder
+from zope.app.interfaces.content.folder import IFolder, IRootFolder, \
+     ICloneWithoutChildren
 from zope.app.services.servicecontainer import ServiceManagerContainer
 from zope.app.interfaces.services.service import IServiceManagerContainer
 from zope.exceptions import DuplicationError
@@ -23,7 +24,7 @@
 class Folder(Persistent, ServiceManagerContainer):
     """The standard Zope Folder implementation."""
 
-    __implements__ = IFolder
+    __implements__ = IFolder, ICloneWithoutChildren
 
     def __init__(self):
         self.data = OOBTree()
@@ -97,6 +98,12 @@
            if the object is not found."""
         del self.data[name]
 
+    def cloneWithoutChildren(self):
+        new = self.__class__()
+        for k, v in self.__dict__.items():
+            if k != 'data':
+                new.__dict__[k] = v
+        return new
 
 class RootFolder(Folder):
     """The standard Zope root Folder implementation."""