Rajeev J Sebastian wrote:

What I also need, is a way to know which objects have changed, without having to maintain copies: the reason is to show those changes to the user in my (long-running) PyQt window.

As I mentioned before, ZODB doesn't provide a mechanism for this. I would like it to for just your sort of application.

Working out the right mechanism (if there is "a" right mechanism)
would take some exerimenttation.  Here are some ideas to try:

- For objects that want to know when they have changed, override
  _p_invalidate.  This is called when an object has been
  modified in another thread (or process).  Your version of
  _p_invalidate could update your application. Note however that
  it would need to make sure that the object's existing state was
  tossed, for example by calling Persistent._p_invalidate.

- If you can use zope.event (from Zope 3), modify
  ZODB.DB.DB.invalidate to generate an event when objects are
  invalidated and modify your application to subscribe to
  the events.

If you decode to these experiments, let us know how they
turn out.


Jim Fulton           mailto:[EMAIL PROTECTED]       Python Powered!
CTO                  (540) 361-1714            http://www.python.org
Zope Corporation     http://www.zope.com       http://www.zope.org
For more information about ZODB, see the ZODB Wiki:

ZODB-Dev mailing list  -  ZODB-Dev@zope.org

Reply via email to