[Zope] Re: returning related objects
Max M
maxm@mxm.dk
Tue, 10 Sep 2002 20:13:26 +0200
VanL wrote:
> /> >/ "Who are the managers that look over Golden Delicious Fields?"
> /> >/ "What kinds of apples are grown in the Valley Orchard?"
> /> >/ /> >/ Currently, I am trying to do a zcatalog query for the known
> item (say, /> >/ the Orchard) and then run up or down the acquisition
> chain to retrieve /> >/ the unknown, but related quantity.
> /> >/ /> >/ Is there an easier way to do this? One of the things that I
> like about /> >/ Zope is the ability to store objects in their natural
> hierarchies. Can /> >/ I use that to get information about objects that
> are related to my /> >/ current object?
You could just create a unique method in ie. the manager class and call
it something like "getmanager()" which returns self. It's a trick I have
used once in a while.
def getmanager():
return context.this()
Hmmm i usually only work in Python products so this is probably a little
off.
then you just call getmanager() on the object from the Catalog and
aquisition takes care of the rest.
regards Max M
"Skeptic Effect" or the "Randi Effect"
When a skeptic is near, supernatural effects seem to disappear.