I have created a .pt template as that contains the following snippet
<span class="help-block">
${password_confirm}
</span>
My Problem is that the password_confirm field will not always be rendered by pyramid framework so it displays the error below
chameleon.utils.NameError
NameError: password_confirm
I understand i am suppose to use a tal:condition but everything i am trying is failing. Can someone help me on how i am suppose to go about variables that will not always be rendered in the template.
Maybe you can add
tal:on-error="nothing"
in the span tag. Then, if error occurs, the whole span will not be rendered.You can use something else instead of nothing.
UPDATE: this approach is not generally advisable, but can be useful as simplest in some cases.
UPDATE2: another variant (not checked with Chameleon)