Skip to content

NameError:Undefined #372

Description

@GuGuMur

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

  • If song_name2 in the parameters set: return the text;
  • If not: no treatment.

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!

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions