[Zope-dev] Linking to objects, or Keeping track of moving objects

Itamar Shtull-Trauring itamars@ibm.net
Sat, 16 Oct 1999 17:21:54 +0200


I'm creating a Recipe object, which will contain numerous Ingredient
objects.  Each Ingredient objects has to point or reference a Food object,
which is stored elsewhere in the database.

So, we can have different Ingredients pointing at the same Food object. 

The question is, how do I create a reference to the Food object?  If I just
store the path to the Food object as a string (e.g. a property containing
"/Foods/Oil/OliveOil"), if someone moves the Food object my reference will
be wrong.  Likewise if someone renames the Food object.

I could each Food object a unique ID, and have some sort of lookup object
that gives the path of an object based on ID, but what happens when someone
does a "Copy" & "Paste"?

I could store Food objects in an SQL db, but I'd much rather use ZODB so I
can use acquisition and to reduce overhead.

Any idea on how to do this?

-- 
Itamar - itamars@ibm.net
---------------------------o----------------------------------------------o
 Perl/Gimp Greeting Cards  | Trust? Ha! The US dollar is backed by ICBMs! |
 http://www.sealingwax.com |      --Anonymous Coward, Slashdot            |