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

Leon de Heus leon@hapkido.nl
Sat, 16 Oct 1999 19:18:55 +0000


I'm fairly new to Zope myself, but I think if you give the Food objects
unique ID's and you create a ZCatalog that indexes that ID property, you
can allways get the path to the Food object (if you keep the ZCatalog up
to date), trough ZCatalogs standard methods. ZCatalog is real easy to
use for that.

I was thinking about that so I could use links based on a unique ID
instead of standard hyperlinks. That way I can move objects around
wherever I want them and don't have to worry about breaking links. 

But then it would of course still be possible to Copy and Paste the
object with that ID, which in your situation would be undesirable...

Best,
Leon de Heus.



Itamar Shtull-Trauring wrote:
> 
> 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            |
> 
> _______________________________________________
> Zope-Dev maillist  -  Zope-Dev@zope.org
> http://www.zope.org/mailman/listinfo/zope-dev
> 
> (Related lists - please, no cross posts or HTML encoding!
> 
> To receive general Zope announcements, see:
> http://www.zope.org/mailman/listinfo/zope-announce
> 
> For non-developer, user-level issues,
> zope@zope.org, http://www.zope.org/mailman/listinfo/zope )