KevinL writes:
On Thu, 2002-08-22 at 04:30, Dieter Maurer wrote:
zope writes:
... Now all my macros are in the same page. I m am trying to use : <div tal:condition="request/form/lkid | nothing"> <tal:block define="mName python:here.oms.Users.lib.pset_links(lkid=request.form['lkid'])"> <metal:block use-macro="container/zptmac_memall/macros/?mName"> List </metal:block> This does not work, because TAL-attributes are only evaluated once all METAL-attributes have been executed.
As a consequence you must not refer to a TAL defined variable in a METAL attribute.
Use a Python script to return the macro object you need.
Furthermore, you cannot suppress a METAL attribute execution with a "tal:condition" (for the same reasons).
Use an (almost) empty macro in such a case (it may need to define slots, when you call it with "metal:fill-slot").
Um. That's wrong, I believe. It's explicitely stated in the documentation.
And, think a moment: Many tal attributes reference things available only under special circumstances, e.g. form variables. When you evaluate them in a different context, you will get exceptions. Then, think of macro expansion. When macro expansion is enabled, you expand macros outside when you look at the template source, outside of any special context. You cannot rely on tal attributes for that. Of course, it would be possible to not look at tal attributes when macro expansion is enable but look at them when it is disabled. But that would be a really strange design.... Dieter