sqlalchemy / mako

Mako Templates for Python
https://www.makotemplates.org
MIT License
353 stars 60 forks source link

Fix the unexpected error that occurs when an empty control block is used. #387

Closed cocolato closed 5 months ago

cocolato commented 7 months ago

Fixes: https://github.com/sqlalchemy/mako/issues/146

When the first control block is empty or comment, the correct result will now be rendered.

from mako.template import Template
template = r"""
% if False:
% elif False:
% else:
    test
% endif
"""

t = Template(template)
print(t.render())

Result:


    test
zzzeek commented 7 months ago

cool.

can we add changelog files to these patches? Dont worry about getting them perfect I can fix them up later

example

https://github.com/sqlalchemy/mako/commit/1d6c58e7124653bc11b0a4f153bdbaab41622854#diff-22252f506a8da7ab5343802f53f7c35770390f669fe0f73a9e2345f0914ebb98

sqla-tester commented 7 months ago

New Gerrit review created for change d0a0981a379ac7a2b8a8e7db6344ed82425ae5b2: https://gerrit.sqlalchemy.org/c/sqlalchemy/mako/+/5148

cocolato commented 7 months ago

Ok, it has been updated.

sqla-tester commented 7 months ago

Patchset 571a73a1d84ee922b38ce5817a5822fbe0268cd0 added to existing Gerrit review https://gerrit.sqlalchemy.org/c/sqlalchemy/mako/+/5148

cocolato commented 7 months ago

Thanks so much for your help! Everything's been updated now.

sqla-tester commented 7 months ago

Patchset fb257ff866148a79bfe58ccaf7c98f499f8d8424 added to existing Gerrit review https://gerrit.sqlalchemy.org/c/sqlalchemy/mako/+/5148

sqla-tester commented 5 months ago

Michael Bayer (zzzeek) wrote:

graet, thanks

View this in Gerrit at https://gerrit.sqlalchemy.org/c/sqlalchemy/mako/+/5148

sqla-tester commented 5 months ago

Gerrit review https://gerrit.sqlalchemy.org/c/sqlalchemy/mako/+/5148 has been merged. Congratulations! :)