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
'\x00\x00\x00\x00\x00\x00\x00\x08'
>>> print p._p_oid
>>> p._p_oid is None
False
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
else:
return False
and now can compare objects for equality after the (Twisted) client
edits them and sends them back.
Anyway, thanks again.
Robert
_______________________________________________
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