[ZODB-Dev] PersistentMapping in BTrees

Thomas Guettler guettli at thomas-guettler.de
Sat May 31 12:00:24 EDT 2003


On Fri, May 30, 2003 at 11:47:07AM -0400, Jeremy Hylton wrote:
> On Fri, 2003-05-30 at 11:35, Thomas Guettler wrote:
> > Hi ZODB gurus,
> > 
> > I want to store instances of a class which derives from
> > PersistentMapping in a OOBTree.
> > 
> > Now I am looking for a way to write the __cmp__ method. Is there
> > something like an id() method for persistent objects? I know addresses
> > of references get lost since they are not persistent. Is there
> > something like a persistent reference?
> 
> What is equality supposed to mean for these objects?

I don't need the __cmp__ for my application. I only need it because I
want to store the object as key in an OOBTree. Up to now these objects
don't have a unique key which could be used.

Unfortunately _p_oid gets set during commit(). Using it in __cmp__
would mean you need to put new objects into a buffer, then commit, and
then put them into the BTree. 

Thank you for your replies. I think I will create unique integer IDs
for the objects and use them in the __cmp__ or use a IOBTree.

 thomas

-- 
Thomas Guettler <guettli at thomas-guettler.de>
http://www.thomas-guettler.de




More information about the ZODB-Dev mailing list