#23913: = comparison does work in templates although it shouldn't
--------------------------------------+------------------------------------
Reporter: googol7 | Owner: nobody
Type: Cleanup/optimization | Status: new
Component: Template system | Version: master
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
--------------------------------------+------------------------------------
Changes (by bmispelon):
* needs_better_patch: => 0
* needs_tests: => 0
* version: 1.7 => master
* needs_docs: => 0
* type: Bug => Cleanup/optimization
* stage: Unreviewed => Accepted
Comment:
Hi,
I was surprised to see that the `=` operator does appear to work so I did
some digging:
* It only works when surrounded by spaces (eg `{% if 1 = 1 %}` works but
not `{% if 1=1 %}`
* It's sortof documented in the `{% if %}` tag's docstring [1]
* it's not actually documented publicly (as you mentionned)
* It's not tested (removing the parsing code for it [2] doesn't break any
test)
Given all this, I'm in favor of removing that "feature".
We still should go through the deprecation policy though, just in case
anyone might be relying on this undocumented and untested feature.
Thanks!
[1]
https://github.com/django/django/blob/c1552af1fe5832011e3b1c3e5b40c20ff3dbe6f9/django/template/defaulttags.py#L988
[2]
https://github.com/django/django/blob/c1552af1fe5832011e3b1c3e5b40c20ff3dbe6f9/django/template/smartif.py#L102
--
Ticket URL: <https://code.djangoproject.com/ticket/23913#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.9cd6971f1c646aa5b945dbacc0d87635%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.