[Zope] Tal:condition problem

Jens Vagelpohl jens@zope.com
Tue, 20 Aug 2002 07:56:02 -0400


i would *not* put both the tal:condition and metal:use-macro statements =
on=20
a single tag. separate them so each is on its own tag::

<div tal:condition=3D"python:request.form['id'] =3D=3D 't' or nothing">
   <metal:block =
use-macro=3D"container/zptmac_memtask/macros/zptmac_taskslist"
 >
     List
   </metal:block>
</div>


jens


On Tuesday, August 20, 2002, at 07:18 , zope wrote:

> Hi All
> I am trying to execute a macro only if a condition is satisified.
> The code I am using is:
> =A0
> <div tal:condition=3D"python:request.form['id'] =3D=3D 't' | nothing"=A0=
=20
> metal:use-macro=3D"container/zptmac_memtask/macros/zptmac_taskslist">
> =A0=A0=A0=A0=A0 List
> </div>
> <div tal:condition=3D"python:request.form['id'] =3D=3D 'p' | nothing"=A0=
=20
> metal:use-macro=3D"container/zptmac_mempending/macros/zptmac_pendlist">
> =A0=A0=A0=A0=A0 List
> </div>
> <div tal:condition=3D"python:request.form['id'] =3D=3D 'w' | nothing"=A0=
=20
> metal:use-macro=3D"container/zptmac_memweek/macros/zptmac_weeklist">
> =A0=A0=A0=A0=A0 List
> </div>
> =A0<div tal:condition=3D"python:request.form['id'] =3D=3D 'a' | =
nothing"=A0=20
> metal:use-macro=3D"container/zptmac_memall/macros/zptmac_alllist">
> =A0=A0=A0=A0=A0 List
> </div>=A0
> Depending on which value is passed with the form object i want that a=20=

> particular macro be called.
> But as soon as this page is rendered it shows me all the macros=20
> irrespective of whether I am sending any value for "id".
> Is there some way I can check the condition and only show the required=20=

> macro.
> I m sure someone working on this particular area dealing with =
different=20
> conditions can help me out.
> =A0
> Best Regards
> =A0
> John Kunchandy
> =A0
> =A0