aboutsummaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
authorÉtienne Pelletier <EtiennePelletier@users.noreply.github.com>2019-05-08 10:47:33 -0400
committerDavid Lord <davidism@gmail.com>2019-05-08 10:47:33 -0400
commit19133d40593ced72eb28e230588abcc70d8b9f82 (patch)
treea92f5b265e9508c4ab6f5a197b3a391e7e35b281 /docs
parent9766c179fad831aa6aa2039882fadc7aff6bba2d (diff)
downloadjinja-19133d40593ced72eb28e230588abcc70d8b9f82.tar.gz
Add ChainableUndefined allowing getattr & getitem (#997)
* Add ChainableUndefined allowing getattr & getitem Allows using default values with chains of items or attributes that may contain undefined values without raising a jinja2.exceptions.UndefinedError. >>> import jinja2 >>> env = jinja2.Environment(undefined=jinja2.ChainableUndefined) >>> env.from_string("{{ foo.bar['baz'] | default('val') }}").render() 'val' * Remove class decorator from ChainableUndefined
Diffstat (limited to 'docs')
-rw-r--r--docs/api.rst4
1 files changed, 3 insertions, 1 deletions
diff --git a/docs/api.rst b/docs/api.rst
index ff0e3b21..8672a42c 100644
--- a/docs/api.rst
+++ b/docs/api.rst
@@ -322,7 +322,7 @@ unable to look up a name or access an attribute one of those objects is
created and returned. Some operations on undefined values are then allowed,
others fail.
-The closest to regular Python behavior is the `StrictUndefined` which
+The closest to regular Python behavior is the :class:`StrictUndefined` which
disallows all operations beside testing if it's an undefined object.
.. autoclass:: jinja2.Undefined()
@@ -353,6 +353,8 @@ disallows all operations beside testing if it's an undefined object.
:attr:`_undefined_exception` with an error message generated
from the undefined hints stored on the undefined object.
+.. autoclass:: jinja2.ChainableUndefined()
+
.. autoclass:: jinja2.DebugUndefined()
.. autoclass:: jinja2.StrictUndefined()