Skip to content

NameError:Undefined #372

@GuGuMur

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!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions