[Zope-dev] Setting vars in expression eval() namespace

Steve Alexander steve@cat-box.net
Wed, 21 Feb 2001 22:24:57 +0000


Julio Maia wrote:

 > Hi,
 >
 > I'm trying to create a tag to evaluate the expression passed to it,
 > adding in the expression eval namespace a variable that contains
 > the result of dtml processing of the tag's block. For instance, the
 >  following construct:
 >
 > <dtml-bvar "foo(a=1)" var="block">
 >   some text <dtml-var "1+2">
 > </dtml-bvar>
 >
 > would invoke the expression "foo(a=1)" with a variable named 'block'
 >  set to 'some text 3' in the expression's namespace (btw, is it
 > possible to achieve this using regular dtml?).

This may be too simple example, but how about:

<dtml-var "foo(a=1, block=('some text %s' % (1+2)))">

--
Steve Alexander
Software Engineer
Cat-Box limited
http://www.cat-box.net