Re: persistence and __setstate__
Jeremy Hylton <[email protected]> Wed, 31 Jul 2002 10:42:49 -0400
| Newsgroups | gmane.comp.python.zope.zodb4 |
|---|---|
| Message-ID | <[email protected]> |
>>>>> "FG" == Florent Guillaume <[email protected]> writes: FG> + /* Prevent the object from being registered as changed. FG> + FG> + If the object is changed while it is being unghostified, FG> + it should not be registered with the data manager as FG> + a changed object. The easiest way to prevent this is FG> + to mark it as already changed, which implies it is FG> + already registered. FG> + */ FG> Doesn't that mean that if an object is changed during its FG> __setstate__ but not after, those changes won't get persisted FG> (because just after __setstate__ the object reverts to UPTODATE) FG> ? Yes. An object is always changed when its __setstate__() method is invoked, except perhaps for some degenerate cases. It would be unacceptable to mark an object as changed every time it is loaded. FG> So won't all objects that upgrade themselves in __setstate__ FG> keep being upgraded whenever they are reloaded, until they are FG> modified from outside __setstate__ ? Yes. Jeremy