summaryrefslogtreecommitdiff
path: root/docs/templates_python.txt
diff options
context:
space:
mode:
authorRussell Keith-Magee <russell@keith-magee.com>2006-09-04 14:02:11 +0000
committerRussell Keith-Magee <russell@keith-magee.com>2006-09-04 14:02:11 +0000
commitcfe77946d70361c338a431bf661bb19e3870eab2 (patch)
treecc61a89a12e27855075a2b4e217c096b9ba048aa /docs/templates_python.txt
parent3a919dbe2e3e2e433b476f87a6625fb17a808180 (diff)
Fixes #2637 -- Clarified handling of TEMPLATE_STRING_IF_INVALID, especially with regards to filtering of invalid values. Modified unit tests to test both empty and non-empty values for TEMPLATE_STRING_IF_INVALID. Thanks to SmileyChris for identifying and helping to resolve this bug.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@3714 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'docs/templates_python.txt')
-rw-r--r--docs/templates_python.txt16
1 files changed, 13 insertions, 3 deletions
diff --git a/docs/templates_python.txt b/docs/templates_python.txt
index aa7fa901b0..8ca68d87d3 100644
--- a/docs/templates_python.txt
+++ b/docs/templates_python.txt
@@ -198,9 +198,19 @@ some things to keep in mind:
How invalid variables are handled
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-If a variable doesn't exist, the template system inserts the value of the
-``TEMPLATE_STRING_IF_INVALID`` setting, which is set to ``''`` (the empty
-string) by default.
+Generally, if a variable doesn't exist, the template system inserts the
+value of the ``TEMPLATE_STRING_IF_INVALID`` setting, which is set to ``''``
+(the empty string) by default.
+
+Filters that are applied to an invalid variable will only be applied if
+``TEMPLATE_STRING_IF_INVALID`` is set to ``''`` (the empty string). If
+``TEMPLATE_STRING_IF_INVALID`` is set to any other value, variable
+filters will be ignored.
+
+This behaviour is slightly different for the ``if``, ``for`` and ``regroup``
+template tags. If an invalid variable is provided to one of these template
+tags, the variable will be interpreted as ``None``. Filters are always
+applied to invalid variables within these template tags.
Playing with Context objects
----------------------------