mako icon indicating copy to clipboard operation
mako copied to clipboard

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

Open cocolato opened this issue 1 year ago • 6 comments

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

cocolato avatar Feb 04 '24 07:02 cocolato

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

zzzeek avatar Feb 04 '24 14:02 zzzeek

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

sqla-tester avatar Feb 04 '24 14:02 sqla-tester

Ok, it has been updated.

cocolato avatar Feb 04 '24 15:02 cocolato

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

sqla-tester avatar Feb 05 '24 17:02 sqla-tester

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

cocolato avatar Feb 06 '24 03:02 cocolato

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

sqla-tester avatar Feb 06 '24 13:02 sqla-tester

Michael Bayer (zzzeek) wrote:

graet, thanks

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

sqla-tester avatar Apr 03 '24 15:04 sqla-tester

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

sqla-tester avatar Apr 03 '24 15:04 sqla-tester