[Zodb-checkins] SVN: ZODB/branches/jim-saner-invalidate-and-deactivate/src/ZODB/ Change the code for creating loading ghost objects to call
Jim Fulton
jim at zope.com
Wed Aug 26 04:05:36 EDT 2009
Log message for revision 103216:
Change the code for creating loading ghost objects to call
_p_invalidate rather than setting _p_changed to None, since the intent
is to guarentee the object is a ghost and an object might have
overridden _p_deactivate with a pass to avoid being deactivated soley
for optimization reasons.
Changed:
U ZODB/branches/jim-saner-invalidate-and-deactivate/src/ZODB/Connection.py
U ZODB/branches/jim-saner-invalidate-and-deactivate/src/ZODB/tests/testConnection.py
-=-
Modified: ZODB/branches/jim-saner-invalidate-and-deactivate/src/ZODB/Connection.py
===================================================================
--- ZODB/branches/jim-saner-invalidate-and-deactivate/src/ZODB/Connection.py 2009-08-26 08:05:31 UTC (rev 103215)
+++ ZODB/branches/jim-saner-invalidate-and-deactivate/src/ZODB/Connection.py 2009-08-26 08:05:36 UTC (rev 103216)
@@ -255,7 +255,7 @@
self._pre_cache[oid] = obj
obj._p_oid = oid
obj._p_jar = self
- obj._p_changed = None
+ obj._p_invalidate()
obj._p_serial = serial
self._pre_cache.pop(oid)
self._cache[oid] = obj
@@ -702,7 +702,7 @@
if obj is None:
return
if serial == ResolvedSerial:
- del obj._p_changed # transition from changed to ghost
+ obj._p_invalidate() # transition from changed to ghost
else:
if change:
obj._p_changed = 0 # transition from changed to up-to-date
Modified: ZODB/branches/jim-saner-invalidate-and-deactivate/src/ZODB/tests/testConnection.py
===================================================================
--- ZODB/branches/jim-saner-invalidate-and-deactivate/src/ZODB/tests/testConnection.py 2009-08-26 08:05:31 UTC (rev 103215)
+++ ZODB/branches/jim-saner-invalidate-and-deactivate/src/ZODB/tests/testConnection.py 2009-08-26 08:05:36 UTC (rev 103216)
@@ -662,10 +662,11 @@
# sanity check
self.assert_(cache.total_estimated_size >= 0)
-
class class_that_ignores_deactivate(Persistent):
- def _p_deactivate(self): pass
+ def _p_deactivate(self):
+ pass
+
def loading_objects_that_ignore_deactivate_bug_185066():
"""See https://bugs.launchpad.net/bugs/185066
@@ -677,7 +678,12 @@
>>> conn2 = db.open()
>>> conn2.root.c.x
1
+ >>> oid = conn2.root.c._p_oid
+ >>> conn3 = db.open()
+ >>> conn3.get(oid).x
+ 1
+
"""
More information about the Zodb-checkins
mailing list