[ZODB-Dev] How do you "wake up" sleepy persistent objects?

Chris McDonough chrism@zope.com
Thu, 11 Oct 2001 15:15:39 -0400


> 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.

This is right.  This can definitely be disconcerting, but usually this only
bites me when I'm in the debugger for whatever reason.

> Is my description correct? Is this expected/known behavior? Is this
behavior
> documented anywhere? Are there any other "gotchas" I need to be aware of
> related to this? Is there a "correct" way to "wake up" a ghost?

I believe that another "gotcha" (if you want to call it this), is that
examining the __class__ attribute of a ghosted object does *not* wake the
object up.   This can actually be handy.