Skip to content

Usage of local variables in the template #5

@denis-itskovich

Description

@denis-itskovich

Can local variables be defined and used in the template?

I tried to use template as simple as following:

@a = 1
@a

and expected that the produced output will be 1, but it failed with the error: NameError: global name 'a' is not defined

Locally, I added a unit test, reproducing this issue:

def testSimpleLocalVariable(self):
  self.assertEquals("1", pyrazor.Render("@a=1\n@a\n"))

Am I missing something?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions