[ZODB-Dev] Re: Server Notification?

Chris Spencer gmane.20.evilspam at spamgourmet.com
Wed Oct 12 02:13:03 EDT 2005


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



More information about the ZODB-Dev mailing list