The following throws a syntax error, "unexpected EOF while parsing":
${foo({'bar':'baz'})}
which I guess is from the inner closing curly brace. This works fine:
${foo(dict(bar='baz'))}
but what's the syntax for using a dictionary literal?
From Brian Rue on the Mako Templates Google Group:
This is a long-outstanding bug; just use dict(). If you need a dictionary with keys that aren't strings, convert a list of tuples into a dict. e.g. instead of this:
${foo({1: 'a', 2: 'b'})}
do this:
${foo(dict([(1, 'a'), (2, 'b')]))}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With