Bug #837
TemplateParser does not allow dashes for indexes
Description
I am trying to use the "ISO-3166-Alpha-2" column from a database to display a country code, however, the item does not not get transformed in the output.
countries=list(model.Countries.List(self.bord))
Template code:
{{ for country in [countries] }}
[country:name] -> [country:ISO-3166-Alpha-2]
{{ endfor }}
Expected output:
...
Netherlands -> NL
...
.
Actual output:
...
Netherlands -> [country:ISO-3166-Alpha-2]
...
I did not see anything related to - being a forbidden character in the TemplateParser docs, or maybe I overlooked it. Is this a forbidden character and is this the issue, or am I doing something else wrong?
Associated revisions
History
#1 Updated by Elmer de Looff over 12 years ago
- Project changed from Underdark to µWeb
- Subject changed from TemplateParser does not properly replace specific database keys. to TemplateParser does not allow dashes for indexes
- Category set to TemplateParser
- Status changed from New to In Progress
- Target version set to µWeb alpha release
- % Done changed from 0 to 30
The dash is indeed not on the list of allowed characters. While many characters are not explicitly on that list (some for good reason, others because adding them is a manual addition to the several regexes), the dash is a useful character to have, and is likely to occur naturally.
I'll add dashes to the allowed characters for both indexes and functions.
#2 Updated by Elmer de Looff over 12 years ago
- Status changed from In Progress to Resolved
- % Done changed from 30 to 70
Applied in changeset ef723cae1a9f.
#3 Updated by Elmer de Looff over 12 years ago
- Status changed from Resolved to In Progress
- % Done changed from 70 to 30
The wiki entry for TemplateParser will need documentation on the allowed characters for all tag parts (name, indexes and functions).
#4 Updated by Elmer de Looff over 12 years ago
- Status changed from In Progress to Closed
- % Done changed from 30 to 100
Confirmed fixed, and documentation updated.
Added dashes as legal characters for template indexes and function names. Updated tests to reflect the changes. This resolves #837.