Opened 3 months ago
Closed 3 months ago
#36465 closed Bug (fixed)
Variables containing dashes are now allowed by the parser
Reported by: | Baptiste Mispelon | Owned by: | Hailey Johnson |
---|---|---|---|
Component: | Template system | Version: | dev |
Severity: | Release blocker | Keywords: | |
Cc: | Triage Stage: | Ready for checkin | |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
This was originally reported in https://code.djangoproject.com/ticket/35816#comment:19
As noted in the link above, the fix for #35816 introduced was I believe to be an unintended side-effect to the parsing rules for variable names.
The documentation for variable names [1] states that:
Variable names consist of any combination of alphanumeric characters and the underscore ("_") but may not start with an underscore, and may not be a number. The dot (".") also appears in variable sections, although that has a special meaning, as indicated below. Importantly, you cannot have spaces or punctuation characters in variable names.
My understanding is that dashes (-
) do not count as alphanumeric and should therefore not be allowed in a variable name.
[1] https://docs.djangoproject.com/en/dev/ref/templates/language/#variables
Change History (5)
comment:1 by , 3 months ago
Owner: | set to |
---|---|
Status: | new → assigned |
comment:2 by , 3 months ago
Triage Stage: | Unreviewed → Accepted |
---|
comment:3 by , 3 months ago
Has patch: | set |
---|
comment:4 by , 3 months ago
Triage Stage: | Accepted → Ready for checkin |
---|
I'm relatively certain I already have a fix for this implemented somewhere, but we made a different decision on my original PR, I'll get a new one up asap :)