SVN: ZODB/trunk/src/ Fixed bug:

Jim Fulton <[email protected]>
Newsgroups gmane.comp.python.zope.zodb.cvs
Message-ID <20090823175842.4DA809417B__48893.9094510444$1251050334$gmane$org@cvs.zope.org>
Log message for revision 103113:
  Fixed bug:
    Objects defining _p_deactivate methods that didn't call base methods
    weren't loaded properly. https://bugs.launchpad.net/zodb/+bug/185066
  

Changed:
  U   ZODB/trunk/src/CHANGES.txt
  U   ZODB/trunk/src/ZODB/serialize.py
  U   ZODB/trunk/src/ZODB/tests/testConnection.py

-=-
Modified: ZODB/trunk/src/CHANGES.txt
===================================================================
--- ZODB/trunk/src/CHANGES.txt	2009-08-23 17:21:09 UTC (rev 103112)
+++ ZODB/trunk/src/CHANGES.txt	2009-08-23 17:58:41 UTC (rev 103113)
@@ -19,6 +19,9 @@
 - Calling __setstate__ on a persistent object could under certain
   uncommon cause the process to crash.
 
+- Objects defining _p_deactivate methods that didn't call base methods
+  weren't loaded properly. https://bugs.launchpad.net/zodb/+bug/185066
+
 3.9.0b5 (2009-08-06)
 ====================
 

Modified: ZODB/trunk/src/ZODB/serialize.py
===================================================================
--- ZODB/trunk/src/ZODB/serialize.py	2009-08-23 17:21:09 UTC (rev 103112)
+++ ZODB/trunk/src/ZODB/serialize.py	2009-08-23 17:58:41 UTC (rev 103113)
@@ -514,9 +514,9 @@
         obj._p_oid = oid
         obj._p_jar = self._conn
         # When an object is created, it is put in the UPTODATE
-        # state.  We must explicitly deactivate it to turn it into
+        # state.  We must explicitly invalidate it to turn it into
         # a ghost.
-        obj._p_changed = None
+        obj._p_invalidate()
 
         self._cache[oid] = obj
         return obj

Modified: ZODB/trunk/src/ZODB/tests/testConnection.py
===================================================================
--- ZODB/trunk/src/ZODB/tests/testConnection.py	2009-08-23 17:21:09 UTC (rev 103112)
+++ ZODB/trunk/src/ZODB/tests/testConnection.py	2009-08-23 17:58:41 UTC (rev 103113)
@@ -663,10 +663,25 @@
         self.assert_(cache.total_estimated_size >= 0)
 
 
+class class_that_ignores_deactivate(Persistent):
+    def _p_deactivate(self): pass
 
+def loading_objects_that_ignore_deactivate_bug_185066():
+    """See https://bugs.launchpad.net/bugs/185066
 
+    >>> db = ZODB.tests.util.DB()
+    >>> conn = db.open()
+    >>> conn.root.c = class_that_ignores_deactivate()
+    >>> conn.root.c.x = 1
+    >>> transaction.commit()
+    >>> conn2 = db.open()
+    >>> conn2.root.c.x
+    1
 
+    """
 
+
+
 # ---- stubs
 
 class StubObject(Persistent):
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.