[Zope] Setting and retrieving a list of linked objects

Dieter Maurer dieter@handshake.de
Mon, 24 Sep 2001 21:08:39 +0200 (CEST)


Pablo Ziliani writes:
 > My problem is this:
 > I have a ZClass "article". I=B4m trying to make each article instance =
show a
 > menu list of "related articles" that will display the title of each ta=
rget
 > instance as the link to it.
 > i.e.:
 > <p>Related articles</p>
 >   <a href=3D"www.mysite.com/path_to/article1">Article One's  Title</a>=
<br>
 >   <a href=3D"www.mysite.com/other/path_to/another/article1">Another Ar=
ticle
 > One's Title</a><br>
 >   <a href=3D"www.mysite.com/other/path_to/article2">Article Two's
 > Title</a><br>
 >=20
 > Problems:
 > - I don't want the link being the target article's path stored in a va=
riable
 > as it will be easily broken (and I will have to learn how to retrieve =
an
 > object's property out of its path, anyway).
 > - I can't simply store the id of the object as this object may not be =
found
 > in the acquisition path and it might be duplicated, so I will need to =
store
 > its context too.
How you determine for a given article, which other articles
are related?

  Try to implement your criterion as a search and
  use ZCatalog to execute the query.
  ZCatalog allows you to obtain the path to any result item,
  to be readily used in your link.

More info on ZCatalog in the Zope book and

  <http://www.dieter.handshake.de/pyprojects/zope/book/chap3.html>



Dieter