#21077: simple_tag does not allow kwargs with dashes in them ---------------------------------+------------------------------------ Reporter: semenov | Owner: Type: Bug | Status: new Component: Template system | Version: 1.5 Severity: Normal | Resolution: Keywords: | Triage Stage: Accepted Has patch: 0 | Needs documentation: 0 Needs tests: 0 | Patch needs improvement: 0 Easy pickings: 0 | UI/UX: 0 ---------------------------------+------------------------------------
Comment (by marfire): The template language doesn't appear to have been designed to be as restrictive as you are calling for. For example, `{% foo-bar %}` ''is'' a perfectly valid template tag name. `{{ my_var|my-filter }}` and `{% my_tag my-arg %}` are also valid. And `{% my_tag my-kwarg=5 %}` is valid if the template tag author doesn't use `simple_tag()`. The question is why it shouldn't also be possible to use `simple_tag()` in this case. The original reason, presumably, was to ensure that keyword arguments could be listed in the function signature (as noted, though, `kwarg_re` fails to ensure that). To me it seems better to treat these keyword arguments like other strings in the template language (allowing `-`, etc.); in addition to being more consistent, this would improve the usefulness of `simple_tag()`, as in semenov's use case. This solution also appears to be backwards compatible. -- Ticket URL: <https://code.djangoproject.com/ticket/21077#comment:5> 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 django-updates+unsubscr...@googlegroups.com. To post to this group, send email to django-updates@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/django-updates/065.e2e2060023356baad39af0142696ec41%40djangoproject.com. For more options, visit https://groups.google.com/groups/opt_out.