(0 or 1) evaluates to 1, so if x == 0 you won't get a hit.

If you must use switch here I think you're going to have to repeat yourself:

<div tal:switch='x'>
  <p tal:case='0'>zero or one</p>
  <p tal:case='1'>zero or one</p>
  <p tal:case='2'>two</p>
</div>

Or you could use tal:condition --

<div>
  <p tal:condition='x in (0,1)'>zero or one</p>
  <p tal:condition='x == 2'>two</p>
</div>


-- Wade

On Thursday, July 12, 2012 4:48:52 AM UTC-4, Geo wrote:

> Hi, I'm wondering how can I write a switch/case block like bellow:
>
> <tal:block tal:switch="x">
>    <tal:case="0 or 1"> 
>       <div> ..... </div>
>    <tal:case="2">
>       <div> ....</div>
> </tal:block>
>
>
> it seems that  *case *doesn't support logic operator (*and* /*or* 
> /*not*)here. 
> So, is there any way I can do it in the switch?
>
>
> Thanks
>
> George Hu
>
>
>
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"pylons-discuss" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/pylons-discuss/-/6m7IqzAd304J.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/pylons-discuss?hl=en.

Reply via email to