Bug #599
TemplateConditional doesn't restrict to tagnames
Description
TemplateConditional expressions are broken in two ways:
- They support local variable names. That is,
{{ if foo == 'bar' }}
is a valid TemplateConditional expression - They place the
repr()
of the object inline in the evaluated string, this breaks for non-idempotent objects (e.g. generators)
History
#1 Updated by Elmer de Looff almost 13 years ago
- Status changed from In Progress to Resolved
- Assignee changed from Elmer de Looff to Jan Klopper
- % Done changed from 30 to 70
This has been fixed by replacing tagnames in TemplateConditional statements by local placeholders, that get mapped to their own local_vars
dictionary, which is provided to eval(locals=)
. Whenever an unknown name is encountered, TemplateNameError
is raised.
A testcase for this has been added to the test suite.
#2 Updated by Elmer de Looff over 12 years ago
- Status changed from Resolved to Closed
- % Done changed from 70 to 100
Working as intended. (no idea why I assigned this away)