Jim Harrison wrote:
Sorry to be dense--I know something similar to this was discussed on the list sometime back--but it would be helpful if someone could give me a hint on the syntax for calling a PythonMethod in an arbitrary folder from within a PythonMethod (in a different folder).
To get at any other object from a PythonMethod, you first need to pass in either a client object (such as this()) or a namespace like '_'. Once you've done that, you can access the other object as an attribute of the client or namespace. Arbitrary paths are a bit trickier, but here's an example Python Method which does it: PythonMethod FetchObj takes an object or namespace, pathname of another object, and optional attribute name to evaluate: <params>_, fetchStr, attr=None</params> obj = _ for p in string.split(fetchStr, '/'): obj = obj[p] if attr is None: return obj else: return render(_.getattr(obj, attr)) This could be called from DTML like this: <dtml-var expr="FetchObj(_, 'hie/dee/hoe', 'id')"> Cheers, Evan @ 4-am