[Zope-CVS] CVS: Products/Ape/lib/apelib/tests - zope2testbase.py:1.11

Shane Hathaway shane at zope.com
Wed Mar 17 20:08:45 EST 2004


Update of /cvs-repository/Products/Ape/lib/apelib/tests
In directory cvs.zope.org:/tmp/cvs-serv8576/tests

Modified Files:
	zope2testbase.py 
Log Message:
It turns out that some applications ghostify unmanaged persistent objects.

In particular, ZCTextIndex does this.  But now the jar for unmanaged
objects saves the state and restores it to de-ghostify.


=== Products/Ape/lib/apelib/tests/zope2testbase.py 1.10 => 1.11 ===
--- Products/Ape/lib/apelib/tests/zope2testbase.py:1.10	Tue Mar 16 23:02:59 2004
+++ Products/Ape/lib/apelib/tests/zope2testbase.py	Wed Mar 17 20:08:14 2004
@@ -696,3 +696,29 @@
 
         finally:
             conn.close()
+
+
+    def testDeactivateUnmanagedPersistent(self):
+        # Some Zope code deactivates unmanaged persistent objects.
+        # Verify that Ape can handle it.
+        conn = self.db.open()
+        try:
+            app = conn.root()['Application']
+            f = Folder()
+            f.id = 'Holidays'
+            f.stowaway = Folder()
+            f.stowaway.id = 'stowaway'
+            f.stowaway._prop = 'value1'
+            app._setObject(f.id, f, set_owner=0)
+            get_transaction().commit()
+            f.stowaway._p_deactivate()
+            self.assertEqual(f.stowaway._prop, 'value1')
+
+            # Check aborting changes to an unmanaged object.
+            f.stowaway._prop = 'value2'
+            self.assertEqual(f._p_changed, 1)
+            get_transaction().abort()
+            self.assertEqual(f.stowaway._prop, 'value1')
+            self.assertEqual(f._p_changed, 0)
+        finally:
+            conn.close()




More information about the Zope-CVS mailing list