[Zope] Re: ZPT: using variables to reference variables
Fri, 02 May 2003 11:55:58 -0500
martin f krafft wrote:
> how can i use a variable to name another variable before this
> variable gets expanded? e.g.:
> myvar = 14;
> a = 'myvar';
> b = $($a); // b = 14
> is this possible with ZPT and/or python?
It is possible with both. In a ZPT:
<div tal:define="myvar python:14;
myvar = 14
a = 'myvar'
b = locals()[a]
*However*, this will not work in Zope's Python-based Scripts, since they
do not allow access to locals().
Evan @ 4-am