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?).
However, I couldn't find a way to set a variable in the namespace used in the
evaluation of the expression. I've tried to insert an entry in the mappings passed to
the expression eval() method as follows:
def __init__(self, blocks):
tname, args, section = blocks[0]
self.section = section.blocks
...
# code that sets self.blockvar as the "var" attribute
# code that sets self.expr as the tag's expression
def render(self, md):
...
d[self.blockvar] = render_blocks(self.section,md) # process the dtml block
d={}; md._push(d)
e = Eval(self.expr, expr_globals).eval(md)
return render_blocks([e],md)
But this doesn't seem to do it.
Any hints on how to make this work?
Julio
_______________________________________________
Zope-Dev maillist - [EMAIL PROTECTED]
http://lists.zope.org/mailman/listinfo/zope-dev
** No cross posts or HTML encoding! **
(Related lists -
http://lists.zope.org/mailman/listinfo/zope-announce
http://lists.zope.org/mailman/listinfo/zope )