#35816: Django Template Language doesn't support all float literals
-------------------------------------+-------------------------------------
     Reporter:  Lily Foote           |                    Owner:  Hailey
                                     |  Johnson
         Type:  Bug                  |                   Status:  closed
    Component:  Template system      |                  Version:  5.1
     Severity:  Normal               |               Resolution:  fixed
     Keywords:                       |             Triage Stage:  Ready for
                                     |  checkin
    Has patch:  1                    |      Needs documentation:  0
  Needs tests:  0                    |  Patch needs improvement:  0
Easy pickings:  0                    |                    UI/UX:  0
-------------------------------------+-------------------------------------
Comment (by Jon Banafato):

 I have a question about template behavior that was changed by this feature
 (please let me know if I should post this as a new ticket instead of
 continuing conversation here). While [https://github.com/jazzband/django-
 hosts/issues/176#issuecomment-2961158554 investigating CI test failures
 for django-hosts], I observed that Django no longer throws a
 TemplateSyntaxError for template variable names containing dashes and
 instead appears to treat them as regular template variable names. I did
 not see any notes in the
 [https://docs.djangoproject.com/en/dev/ref/templates/language/#variables
 template language documentation] or the templates section of the
 [https://docs.djangoproject.com/en/dev/releases/6.0/#templates release
 notes] for 6.0. I believe this change was introduced by the commit
 associated with this issue, and I've included an example of the behavioral
 change below.

 On commit 8df5ce80d26824ce72af41edc03275d435de9432, the following code
 fails with a TemplateSyntaxError as expected.

 {{{
 >>> from django.template import Template, Context
 >>> template = Template("Hello, {{ first-name }}")
 Traceback (most recent call last):
 ...
 django.template.exceptions.TemplateSyntaxError: Could not parse the
 remainder: '-name' from 'first-name'
 }}}

 On commit 5183f7c287a9a5d61ca1103b55166cda5, the following code parses the
 template and renders the `first-name` provided.

 {{{
 >>> from django.template import Template, Context
 >>> template = Template("Hello, {{ first-name }}")
 >>> template.render(Context({"first-name": "Jon"}))
 'Hello, Jon'
 }}}

 Does this warrant a new ticket for a behavior and / or documentation
 change? I'd be happy to help  where possible, but I'm not very familiar
 with this change or the Django development process in general, so I am
 looking for guidance. Thanks!
-- 
Ticket URL: <https://code.djangoproject.com/ticket/35816#comment:19>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion visit 
https://groups.google.com/d/msgid/django-updates/010701976667eef9-a49da15e-6129-47b8-9277-ddb1de235889-000000%40eu-central-1.amazonses.com.

Reply via email to