[Zope-dev] calling external method from external method

Dieter Maurer dieter@handshake.de
Tue, 27 Jun 2000 00:37:53 +0200 (CEST)


Robert Roberts writes:
 > How do I call one external method from another external method?
You simply call it.

 > Here is what I mean:
 > 
 > The user has entered the id of valid external method in a form field.
 > (This is during setup of a Product and is not accessible anonymously)
 > 
 > At a later point, an external method is running (part of the product)
 > that gets the id that was entered above.
 > 
 > I would then like to execute the method belonging to that id from
 > within the python method that is running.
Your main problem: resolve the "id" into an object.
For this, you should either pass a namespace or an object
as parameter to the first method.
If you use a namespace "ns", you access "id" by "ns[id]",
for an object "o", you would use "getattr(o,id)".

Once you have the method corresponding to "id", you simply
call it.


Dieter