[ZODB-Dev] How do you "wake up" sleepy persistent objects?
Shane Hathaway
shane@zope.com
Thu, 11 Oct 2001 15:05:18 -0400
Patrick K. O'Brien wrote:
> 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.
>
> 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?
>
> (With Halloween right around the corner, you'd think I'd have a good joke
> for that last question. Hmmm... How do you wake up a ghost? By pulling off
> his sheet? I don't know. Where are my kids when I need them?)
I usually use hasattr() to wake them up. Any attribute will do...
hasattr(object, 'flesh') ;-)
Shane