_p_deactivate must honor first call
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
ZODB |
Fix Released
|
Medium
|
Unassigned |
Bug Description
I am not sure if this is a documentation bug or a code bug, but this recently cost me half a day to figure out.
The _p_deactivate method can be overridden in subclasses of persistent to control the "optimistic ghostification" of objects. The current documentation in persistent.
Possibly change an object in the saved state to the
ghost state. It may not be possible to make some persistent
objects ghosts, and, for optimization reasons, the implementation
may choose to keep an object in the saved state.
"""
What it fails to mention is that _p_deactivate is called when initially creating a ghost in order to set the _p_changed attribute to None. (ZODB/serialize
In this call, the state has not yet been set so if the call is ignored, _p_changed remains False. The end result is that the state is never loaded.
Changed in zodb: | |
importance: | Undecided → High |
Changed in zodb: | |
status: | Incomplete → Confirmed |
Changed in zodb: | |
status: | Fix Committed → Fix Released |
milestone: | none → 3.10.0a1 |
It looks like this has been fixed on the trunk and on the 3.8 branch. At least, there's no _p_deactivate call on line 511 of serialize and there is an explict assignment of _p_changed to None.
Could you please verify the fix or provide more information?