Reputation: 203
I'm totally new to Mako so bear with me.
I have a series of blocks being used for layout. One of the blocks requires some variables declared on the same page. I can't get it to work properly. This is quite basic, I know, but I'm learning and can't find the solution in the Mako docs. What's the proper syntax and/or method to do this?
I would like to keep userInputViews more global as it is used similarly in other blocks as well. The value of currentSet is arbitrary and not to be analyzed as it is being passed to the page and works fine.
The error I get is about userInputViews being Undefined.
<% userInputViews = [ "MediatorAddress", "MediatorDateOfBirth", "MediatorEmailAddress" ] %> <%block name="contentAction"> % if set(userInputViews) == set(currentSet): user inputs are currently selected % endif </%block>
Upvotes: 2
Views: 942
Reputation: 21
I'm just trying to learn Mako myself but I believe that you have declared userInputViews in a different namespace than the block.
http://docs.makotemplates.org/en/latest/runtime.html
Suggests calling the render with an empty dict as a "variable" and then insert your "global" variables into the dict.
Look for So what if I want to set values that are global to everyone within a template request? For the example
Upvotes: 2