On 2006/06/27, at 3:49, Benji York wrote:

Robert Gravina wrote:
I just tried loading a persisted object interactively and noticed that although the _p_oid doesn't print out as anything (and hence I always thought it was empty in my debugging prints), it isn't actually None! Can anyone explain this? (here "p" is my persisted object)
 >>> p._p_oid
 >>> print p._p_oid
 >>> p._p_oid is None

What would you expect to see if you printed out seven null characters and a backspace?

Hahaha - that's a good point! I was expecting IDs to look, well, something like "asdf23asdf". Well, anyway thankyou! 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.

Anyway, thanks again.


For more information about ZODB, see the ZODB Wiki:

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

Reply via email to