17 Aug
2002
17 Aug
'02
9:39 a.m.
VanL writes:
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? Hell! Do you know "[un]restrictedTraverse"?
Dieter