On Jun 26, 2006, at 3:11 PM, Robert Gravina wrote:

I seemed to have solved this problem. I was able to write a __eq__ function like this:

    def __eq__(self, other):
        if isinstance(other, <name of my class>):
if hasattr(other,"_p_oid") and other._p_oid != None and (other._p_oid == self._p_oid):
                return True
                return False

and now can compare objects for equality after the (Twisted) client edits them and sends them back.

To be *really* careful in the face of multi-databases, you'd check database names too. See the zope.app.keyreference.persistent code, for instance.

If you don't have multidatabases, then this code looks like it will do the job.

For more information about ZODB, see the ZODB Wiki:

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

Reply via email to