[Zope] two object is the same
zope at netchan.cotse.net
zope at netchan.cotse.net
Tue Mar 30 14:15:01 EST 2004
In my unittest, I have to check that a specified zodb object is the same
(e.g. not deleted and recreated) after an operation as it was before. I
thought I could do this:
ob = df._getOb(drid)
[...] # do something
if ob is not df._getOb(drid):
# object changed
('df' is inherited from Folder, 'ob' is from SimpleItem)
However this doesn't work because the 'is' operator uses the memory
address of the objects and these are not the same in subsequent calls:
(Pdb) id(df._getOb(drid))
177727520
(Pdb) id(df._getOb(drid))
177727424
(Pdb) id(df._getOb(drid))
177727520
(Pdb) id(df._getOb(drid))
177727424
(Pdb) id(df._getOb(drid))
177727520
(Pdb) id(df._getOb(drid))
177727424
Is there any deterministic way for performing the check above?
Regards,
Sandor
More information about the Zope
mailing list