Skip to content

passing args to included template #395

Discussion options

You must be logged in to vote

Hi -

First thing that will help, when posting code on github, use triple backticks for formatting. I had to copy and paste your code examples and manually guess where the indentation was.

Next, in Python, when we have dictionary structures such as mystruct = {"bob": "charlie"}, we use indexed access like mitem['ItemName'], your example uses object syntax which does not work here based on the data you are passing.

Finally, to declare arguments in a mako template that must be passed, use the page tag to declare those variables.

your code can be formatted into a working demo as below

from mako.lookup import TemplateLookup

lookup = TemplateLookup(strict_undefined=True)

lookup.put_string(
    

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@stevegeo386
Comment options

Answer selected by stevegeo386
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants