[Zope] How to call a script by it's name stored in a variable.

Jonathan dev101 at magma.ca
Wed Feb 21 07:38:00 EST 2007


----- Original Message ----- 
From: "rieh25" <robertoedwins at gmail.com>
To: <zope at zope.org>
Sent: Tuesday, February 20, 2007 10:30 PM
Subject: [Zope] How to call a script by it's name stored in a variable.


>
> How can I do something like this?
>
> var = '/Projects/test_py'
>
> return call_by_name(var)

Another option: if the script you want to call is in the same folder as the 
calling script then this will work:

var = 'test_py'
return getattr(context, var)()


Jonathan



More information about the Zope mailing list