On Monday 22 October 2001 05:40 pm, Max M allegedly wrote:
From: Casey Duncan [mailto:c.duncan@nlada.org]
They way to do this is to create a lines property in the student and store the ids of the related subjects there. You use a ZCatalog and a keyword index on this property to quickly find which students belong to which subject.
Again only if the id's are unique all over the site.
2. Assign another fixed key as a property (or general attribute) of the subject for use as the unique identifier and don't ever change it for the life of the object.
There allready exist such a key for each object in the ZODB called the oid, but I don't think that it's easy to get at through normal means. I am not even shure that it's "allowed" to use it for anything.
I would not use oids, they can change for instance if you export and re-import objects.
You will need to use a ZCatalog to make lookups on this id efficient, but this would allow you to put the object anywhere you like, and rename them without screwing up the relationships. Only deletion would break it.
Deletion always has a tendency to do this. I need triggers in the ZODB :-)
regards Max M
ObjectManager has such a mechanism. It calls manage_beforeDelete on an object before it is deleted. /---------------------------------------------------\ Casey Duncan, Sr. Web Developer National Legal Aid and Defender Association c.duncan@nlada.org \---------------------------------------------------/