[Zope3-checkins] CVS: Zope3/src/zope/app/services/tests - placefulsetup.py:1.25

Marius Gedminas mgedmin@codeworks.lt
Thu, 5 Jun 2003 06:26:55 -0400


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

Modified Files:
	placefulsetup.py 
Log Message:
Fix infinite recursion with PlacefulSetup.rootFolder caused by the descriptor
accidentally calling itself.

Remove spurious line from PlacefulSetup.createRootFolder.


=== Zope3/src/zope/app/services/tests/placefulsetup.py 1.24 => 1.25 ===
--- Zope3/src/zope/app/services/tests/placefulsetup.py:1.24	Tue Jun  3 18:46:22 2003
+++ Zope3/src/zope/app/services/tests/placefulsetup.py	Thu Jun  5 06:26:54 2003
@@ -32,8 +32,10 @@
         if inst is None:
             return self
 
-        try: root = inst.rootFolder
-        except AttributeError:
+        try:
+            # Use __dict__ directly to avoid infinite recursion
+            root = inst.__dict__['rootFolder']
+        except KeyError:
             root = inst.rootFolder = setup.buildSampleFolderTree()
 
         root = ContextWrapper(root, None)
@@ -43,7 +45,7 @@
 
     # Places :)
     rootFolder  = Place('')
-    
+
     folder1     = Place('folder1')
     folder1_1   = Place('folder1/folder1_1')
     folder1_1_1 = Place('folder1/folder1_1/folder1_1_1')
@@ -54,7 +56,7 @@
     folder2     = Place('folder2')
     folder2_1   = Place('folder2/folder2_1')
     folder2_1_1 = Place('folder2/folder2_1/folder2_1_1')
-    
+
 
     def setUp(self, folders=False, site=False):
         setup.placefullSetUp()
@@ -73,9 +75,8 @@
     def makeSite(self, path='/'):
         folder = zapi.traverse(self.rootFolder, path)
         return setup.createServiceManager(folder)
-        
+
     def createRootFolder(self):
-        self.rootFolder 
         self.rootFolder = RootFolder()
 
     # The following is a hook that some base classes might want to override.
@@ -88,4 +89,4 @@
 
         setup.createStandardServices(self.rootFolder,
                                      hubids=self.getObjectHub())
-    
+