Chris Spencer wrote:

For instance, using chatter.py as a guide, I wrote a simple script (shown below) that modifies a persistent object on a zeoserver, and recieves notifications of changes to the object, although the local callback is never called.


One minor correction. My callback is never getting called because ZODB is loosing all volatile values after it's invalidated. So this

    def _p_invalidate(self):
        Persistent._p_invalidate(self)
        print 'invalidated'
        if hasattr(self, '_v_update_cb') and callable(self._v_update_cb):
            self._v_update_cb()

Should really be:

    def _p_invalidate(self):
        cb = self._v_update_cb # save callback
        if hasattr(self, '_v_update_cb') and callable(self._v_update_cb):
            self._v_update_cb()
        Persistent._p_invalidate(self)
        self._v_update_cb = cb # restore callback
        print 'invalidated'

This restores the volatile value after it's destroyed by ZODB. However, is this really necessary? Obviously, volatile values shouldn't be persisted on the server, but should server actively erase them on the client as well?

Regards,
Chris

_______________________________________________
For more information about ZODB, see the ZODB Wiki:
http://www.zope.org/Wikis/ZODB/

ZODB-Dev mailing list  -  ZODB-Dev@zope.org
http://mail.zope.org/mailman/listinfo/zodb-dev

Reply via email to