NameError:Undefined #374
Unanswered
GuGuMur
asked this question in
Usage Questions
Replies: 1 comment 1 reply
-
the example as given works without issue, because you dont have strict_undefined configured: from mako.template import Template
temp = Template("""
% if song_name2:
|second=${song_name2}
% endif
""")
print(temp.render(song_name2="Stasis"))
print(temp.render()) if you do have strict_undefined configured, give the template a default using from mako.template import Template
temp = Template("""
<%page args="song_name2='default song'"/>
% if song_name2:
|second=${song_name2}
% endif
""", strict_undefined=True)
print(temp.render(song_name2="Stasis"))
print(temp.render()) |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hello!
I'm using Mako to generate wikitext.
I want:
song_name2
in the parameters set: return the text;My code:
Thanks!
Beta Was this translation helpful? Give feedback.
All reactions