sqlalchemy / mako

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

NameError:Undefined #372

Closed GuGuMur closed 1 year ago

GuGuMur commented 1 year ago

Hello! I'm using Mako to generate wikitext. I want:

My code:

from mako.template import Template
temp = Template("""
% if song_name2:
|second=${song_name2}
% endif
"""))
temp.render(song_name2="Stasis")   #return "|second=Stasis"
temp.render()                      #return NameError:Undefined——I want an empty string.

Thanks!