On 14.03.2007, at 19:16, Dieter Maurer wrote:

Bernd Dorn wrote at 2007-3-14 11:39 +0100:
but after the import in the .ids attribute of the util (which is an
OIBtree) raises a KeyError for an existing key

so if i do

key in sorted(self.ids)
KeyError ...

I can explain to you why you may get different results (also I cannot
tell you why you have the inconsistency).

An XYBTree uses two different structures for the enumeration of
its elements (e.g. "iter(tree)") and the random access (e.g. tree [key]).

The tree root has a link to its left most leaf and all
leaves are linked together. These links use used for enumeration.

Random access uses the internal nodes to find the leaf that may
contain the key and then access it there.

What you see means that the leaf links are correct but some
internal node is broken (contains a stale reference).

hi dieter

thx for the answer ... but now i found out why this happens, it is a KeyReferenceToPersistence problem in zope, so this is the wrong list :-(

but just for the records:

keyreference uses its object's oid and database name to build its hash from, so when you export and reimport objects referenced, the hashes are wrong, because the objects have new oids

i will fix those hashes at import time in my package, where the old and the new oid are available

thx, bernd


For more information about ZODB, see the ZODB Wiki:

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

Reply via email to