if statement - If condition doesn't work in Tornado (Python) -


i have problem. in tornado handler pass parameters html page.

the code of page this:

 {% if not writeable %}     {% if not usrpermdev %}     $("#chart_div").html("<div class='alert'><strong>warning!</strong> don't have permission view page.</div>")     {% elif usrpermdev==0 %}     $("#chart_div").html("<div class='alert'><strong>warning!</strong> don't have permission view page.</div>")     {% end %}   ...... 

end it's because want show <div> element or not in case of permissions.

now if put prints in tornado handler see example:

usrpermdev = [{'perm': 4l}] writeable = false 

so why code doesn't show after control?

if code enter in if (not writeable), check if usrpermdev there is. in case program should not enter in both of next if , go on.... why not happen?

ps. don't see anything.... not warning alert! program don't enter in if(s) don't go on...

i have same issue you. if set

{% if writeable=="false" %} 

it still not work. looks tornado not care boolean value in if clause. if change writeable value true or false, output in template

{{ writeable }} 

you see text like

true

or

false

but still not go if clause. p.s. it's tornado 4.2.1 on linux. weird!


update

solved

i have fixed using clause {% if writeable false %} , remember ,you should use in under template block, rather using if upper template block.


Comments

Popular posts from this blog

get url and add instance to a model with prefilled foreign key :django admin -

css - Make div keyboard-scrollable in jQuery Mobile? -

ruby on rails - Seeing duplicate requests handled with Unicorn -