Project

General

Profile

Bug #599

TemplateConditional doesn't restrict to tagnames

Added by Elmer de Looff about 12 years ago. Updated about 12 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
-
Target version:
-
Start date:
2012-01-26
Due date:
% Done:

100%

Estimated time:
Spent time:

Description

TemplateConditional expressions are broken in two ways:
  1. They support local variable names. That is, {{ if foo == 'bar' }} is a valid TemplateConditional expression
  2. 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 about 12 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 about 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)

Also available in: Atom PDF