Re: [Zope] How to call a script by it's name stored in a variable.
- Original Message - From: "rieh25" <[EMAIL PROTECTED]> To: 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 ___ Zope maillist - Zope@zope.org http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev )
Re: [Zope] How to call a script by it's name stored in a variable.
rieh25 wrote: > How can I do something like this? > > var = '/Projects/test_py' > > return call_by_name(var) > > > Thanks. fun = context.restrictedTraverse(var) return fun() then there is path and getattr you should look at. robert begin:vcard fn:robert rottermann n:rottermann;robert email;internet:[EMAIL PROTECTED] tel;work:031 333 10 20 tel;fax:031 333 10 23 tel;home:031 333 36 03 x-mozilla-html:FALSE version:2.1 end:vcard ___ Zope maillist - Zope@zope.org http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev )