Opened 9 years ago
Closed 9 years ago
#25067 closed Bug (duplicate)
Allowing all characters when parsing inclusion templatetags
Reported by: | Sven R. Kunze | Owned by: | nobody |
---|---|---|---|
Component: | Template system | Version: | dev |
Severity: | Normal | Keywords: | inclusion_tag, parse_bits, token_kwargs |
Cc: | Triage Stage: | Unreviewed | |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | yes | UI/UX: | no |
Description (last modified by )
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
.
Change History (2)
comment:1 by , 9 years ago
Description: | modified (diff) |
---|
comment:2 by , 9 years ago
Resolution: | → duplicate |
---|---|
Status: | new → closed |
Note:
See TracTickets
for help on using tickets.
Seems to be closely related to #21077 (I believe both reference the
kwarg_re
regular expression) so I'm going to close this as a duplicate. Feel free to put together a patch to assess feasibility and write to mailing list if you disagree with the conclusions of that ticket.