[ZODB-Dev] Object uniqueness

Markus Läll markus3 at ut.ee
Fri Oct 3 06:33:50 EDT 2008


Hi!

In which scope does zodb preserve object uniqueness?

The problem I'm having is I have Person-objects in two places, in a set of
persons (root[Person], which is an OOSet) and in name-index (root[(Name,
Person)], which is a OOBTree).

Now if I find people by name from the name index, they seem not to be the
same in the set of all Person-objects...

All the Persons get into the OSet and OOBTree like this: firstly the
created person is just added to the OOSet; then its "index" method is
called which returns a list of tuples -- in my case it's just (from the
objects' point of view) [(self.name, self)]. USing that my db gets the
types of both of them-- Name and Person --and then puts them in the
appropriate index by doing root[(Name, Person)][ name ].update([ prerson
]). And now if I retrieve some person from the name-index, I cannot remove
(by method "remove") them from the OOSet of all persons, because it raises
a KeyError.

Yet if I iter through the set of persons, one of them *is* the one I got
from the name-index... What am I thinking wrongly about?

Markus



More information about the ZODB-Dev mailing list