Opened 4 years ago

Closed 4 years ago

#32157 closed Cleanup/optimization (worksforme)

Additional information to the "with" templatetag.

Reported by: Jan Hangebrauck Owned by: nobody
Component: Template system Version: 3.1
Severity: Normal Keywords: templatetags with
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

After a lot of bug searching, I found out that when I use a variable which is None in the with templatetag, it is converted to empty string "". I'm not sure if this is the intended behavior, but if it is, this could be mentioned in the documentation.

in python:
context = { var1: None }

in template:
{% with x=var1 %}
{% if x is None %}
this will not print
{% endif %}
{% if x == "" %}
this will print
{% endif %}
{% endwith %}

Attachments (1)

test-32157.diff (1.1 KB ) - added by Mariusz Felisiak 4 years ago.
Tests.

Download all attachments as: .zip

Change History (2)

by Mariusz Felisiak, 4 years ago

Attachment: test-32157.diff added

Tests.

comment:1 by Mariusz Felisiak, 4 years ago

Component: DocumentationTemplate system
Resolution: worksforme
Status: newclosed
Summary: Additional information to the "with" templatetagAdditional information to the "with" templatetag.

Thanks for this report, however I cannot reproduce this issue. Please check attached tests.

Note: See TracTickets for help on using tickets.
Back to Top