[ZODB-Dev] How do you "wake up" sleepy persistent objects?
Greg Ward
gward@mems-exchange.org
Thu, 11 Oct 2001 15:07:45 -0400
On 11 October 2001, Patrick K. O'Brien said:
> When a persistent object is in the ghost state, it appears that the results
> of dir(object) are not the same as when the object is in some other state.
> It also appears that doing dir(object) wakes up the object (albeit, after
> the fact) so that a subsequent dir(object) returns the results that you
> would expect.
I have observed exactly that behaviour myself. AFAIK, it's not
documented anywhere. I usually use dir(self) to "wake up" a ghost
object, although I have also been known to use hasattr(self, "foo"). I
doubt that it matters, but dir(self) seems cleaner. It seems that you
just need to do something that requires the object's __dict__.
Greg
--
Greg Ward - software developer gward@mems-exchange.org
MEMS Exchange http://www.mems-exchange.org