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

Julio Maia julio@pobox.com
Wed, 21 Feb 2001 17:48:51 -0200


On Wed, Feb 21, 2001 at 10:24:57PM +0000, Steve Alexander wrote:
> 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)))">

This is not going to be handy once the block is composed by a large dtml block. I wonder if dtml-var shouldn't support the syntax I've described above.

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