[Zope] Is there a function which evaluate a python expression situated in a string variable ?

Tino Wildenhain tino@wildenhain.de
Fri, 21 Jul 2000 10:38:13 +0200


Hi Frederic,

Frederic QUIN wrote:
> 
> Hi all,
> 
> I have a string variable "expres" which contains a python expression.
> I would like to do <dtml-call "expres.manage_addFolder('new_folder')"> but
> Zope raises an error. expres is considered as a string and is not
> interpreted by Zope. So I wonder if there is a function which evaluate the
> python expression situated in my string variable...
> 
assuming your expression leads to the name of the object you want 
to add a folder, you could use:

<dtml-call "_[expres].manage_addFolder('new_folder')">

(this is not so simple, if your expres contains or evaulates to
something
with . (periods) in it. Then you would have to split or look along the
mailinglist, there was mentioned something like "get object from url"

HTH
Tino Wildenhain