[Zope] Continued problem tal:condition

Dieter Maurer dieter@handshake.de
Wed, 21 Aug 2002 20:30:24 +0200


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").

 > ...
 >   <div tal:condition="request.form.get('lkid') == 't' ">
Here, a "python:" is missing.


Dieter