#25067: Allowing all characters when parsing inclusion templatetags
-------------------------------------+-------------------------------------
Reporter: srkunze | Owner: nobody
Type: Bug | Status: new
Component: Template system | Version: master
Severity: Normal | Resolution:
Keywords: inclusion_tag, | Triage Stage:
parse_bits, token_kwargs | Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by srkunze):
* needs_docs: => 0
* needs_tests: => 0
* needs_better_patch: => 0
Old description:
> We use the inclusion_tag to create a special HTML DIV element with
> several custom attributes; basically like this:
>
> {{{
> @inclusion_tag('...')
> def my_tag(x, **kwargs):
> return {
> 'y': x +1,
> 'extra_attrs': kwargs,
> }
> }}}
>
> Unfortunately, django/template/base.py:token_kwargs does not recognize
> '-' in variable names so that extra HTML attrs such as 'data-myattr'
> cannot be added to the DIV.
>
> Python as such supports special characters in **kwargs.
New description:
We use the inclusion_tag to create a special HTML DIV element with several
custom attributes; basically like this:
{{{
@inclusion_tag('...')
def my_tag(x, **kwargs):
return {
'y': x +1,
'extra_attrs': kwargs,
}
}}}
Unfortunately, django/template/base.py:token_kwargs does not recognize '-'
in variable names so that extra HTML attrs such as 'data-myattr' cannot be
added to the DIV.
Python as such supports special characters in {{{**kwargs}}}.
--
--
Ticket URL: <https://code.djangoproject.com/ticket/25067#comment:1>
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 post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/065.44e41ced027f46e0b748d9c15d6be50d%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.