Because of the way web2py rein dent python code in templates. You have to do

 {{if deal.name == 'phone +7':}} {{url = URL('to_phone','index')}}
                {{elif deal.name == 'WALLET':}} {{url = 
URL('to_wallet','index')}}
                {{else:}} {{url = URL('to_deal','index', args=[deal.id])}} 
{{pass}}

If I line does not end in ":" then there is no block and the next line 
cannot have a "elif" or "else".

On Monday, 20 July 2015 01:14:39 UTC-5, [email protected] wrote:
>
>
> syntax error - why?
>                 {{if deal.name == 'phone +7': url = 
> URL('to_phone','index')}}
>                 {{elif deal.name == 'WALLET': url = 
> URL('to_wallet','index')}}
>                 {{else: url = URL('to_deal','index', args=[deal.id])}}
>
>
> Traceback
>
> 1.
> 2.
> 3.
> 4.
> 5.
> 6.
> 7.
> 8.
> 9.
> 10.
>
> Traceback (most recent call last):
>   File "C:\web2py-m\gluon\restricted.py", line 226, in restricted
>     ccode = compile2(code, layer)
>   File "C:\web2py-m\gluon\restricted.py", line 209, in compile2
>     return compile(code.rstrip().replace('\r\n', '\n') + '\n', layer, 'exec')
>   File "C:\web2py-m\applications\app_bs3\views\where3/list.html", line 105
>     elif deal.name == 'WALLET': url = URL('to_wallet','index')
>        ^
> SyntaxError: invalid syntax
>
>
>
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to