#36465: Variables containing dashes are now allowed by the parser
-------------------------------------+-------------------------------------
Reporter: Baptiste Mispelon | Type: Bug
Status: new | Component: Template
| system
Version: dev | Severity: Release
| blocker
Keywords: | Triage Stage:
| Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
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
--
Ticket URL: <
https://code.djangoproject.com/ticket/36465>
Django <
https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.