Mako "Missing parentheses in %def"
In trying to add a cached section to a Mako template, I get the erro开发者_JAVA百科r listed in the above question. Adding ()
to the end gets rid of the error, but I see no content on my page. Any help is appreciated!
<%def name="test" cached="True" cache_timeout="60" cache_type="file">
Test
/%def>
My problem was that I was not aware that <%def>
defines a function. If I use the parenthesis and call the function via ${test()}
right after definition, it works as expected.
Shouldn't you be using parantheses while defining the def
test.
Also if the "cached" etc. are parameters then I think your
your definition should be something like below:
<%def name="test(cached='True',cache_timeout='60',cache_type='file')">
Test
/%def>
Also see the Mako documentation
精彩评论