On Thursday 12 November 2015 18:22:23 Tim Graham wrote:
> The expected behavior of the {% if %} tag isn't clear to me. How do you
> propose to solve the "bug"? As I noted in the ticket:
>
> We end up checking {% if <string_if_invalid> %} which passes for a
> non-empty string_if_invalid.
It seems pretty obvious to me that anything which would be replaced by
string_if_invalid should be falsey. This is because string_if_invalid is
supposed to be a debug aid -- showing when "invalid" happens -- while the
"production" value in a template is an empty string. It is also what happens
for undefined variables, irrespective of string_if_invalid. That is, the bug as
I see it is the mismatch between
{% if undefined %}
This is not rendered, regardless of string_if_invalid
{% endif %}
and
{% if obj.missing_relation %}
This may be rendered, depending on string_if_invalid
{% endif %}
They should be the same (and the former seems less wrong than the latter).
What am I missing?