[Zope] Object reload event?

Dieter Maurer dieter at handshake.de
Wed Mar 10 15:48:32 EST 2004


Dylan Jay wrote at 2004-3-9 16:37 +1100:
>I have an object that uses manage_afterAdd to install several subobjects.
>When this object is refreshed or zope is started I want to have a method run
>on each instance of that object to ensure these subobjects are still there
>and are of the right type. How do I do this?

Whenever an object is loaded from ZODB, its "__setstate__" method
is called.

However, you are severely restricted what you can do in this
method:

  *  "self" is not acquisition wrapped.

     This means, you cannot access the position of the object
     inside the Zope object hierarchy.

  *  Modification you make to the object may not become persistent.


It is probably better to design a consistency checking script
that periodically checks your consistency requirements.

Even better would be to prevent your system to become
inconsistent (rather than detect inconsistency at a later time).

-- 
Dieter



More information about the Zope mailing list