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
            else:
                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.

Gary
_______________________________________________
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