[Zope] Do-it-yourself acquisition -- is there an easier way?
VanL
vlindberg@verio.net
Thu, 15 Aug 2002 11:53:53 -0600
Hello,
I have python products and python scripts in which I am trying to get a
certain object, by id, from higher up in the acquisition chain.
I know that this object is in a folder named 'toolbox', so the code I
have is as follows:
def get_foo(self, fooID):
default_foo = None
for parentObj in self.aq_chain:
try:
toolbox = parentObj._getOb('toolbox')
foo = toolbox._getOb(fooID)
return foo
except: continue
return default_foo
This works, but seems very clunky. Is there an API call that is
cleaner? Does the method above have a hidden danger or difficulty that
I am not seeing?
Thanks,
VanL