sqlalchemy/mako

how do you pass a dict as a parameter to <%namespace:def

zzzeek opened this issue · 2 comments

Discussed in #396

Originally posted by jjgalvez May 5, 2024
How do I pass a dict to a def when it's called from <%namespace:def>.
I would expect that calling
<%namespace:def param="${ {'id':123} }"></namespace:def> to work, but when I do I get an error saying I am missing a closing }
for reference <%call expr="namespace.def(param={'id':123})"></%call> works as expected.

Jose has proposed a fix for this issue in the main branch:

Update parsetree.py removed "?" from for x in re.compile(r"(${.+})" … https://gerrit.sqlalchemy.org/c/sqlalchemy/mako/+/5296

bug remains open as we have to revert this, see #401