From 56fb5035d47e1260d61a8d3def7b78368d67c358 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Marsino=20Piqu=C3=A9?= Date: Tue, 14 Jul 2026 14:56:39 +0200 Subject: [PATCH] docs: clarify dictionary method keys --- docs/index.rst | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/docs/index.rst b/docs/index.rst index 46cf69f..e5d4280 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -136,6 +136,13 @@ Note the ``r`` right after the opening braces. **VERY IMPORTANT :** Variables must not contains characters like ``<``, ``>`` and ``&`` unless using Escaping_ +Dictionary keys named like dictionary methods must use bracket notation. For +example, use ``{{ soil['pop'] }}`` for ``context = {'soil': {'pop': 2}}``. +``{{ soil.pop }}`` resolves to the dictionary ``pop`` method instead of the +``'pop'`` key. With autoescaping disabled, rendering that method representation +can produce invalid XML; ``autoescape=True`` prevents the invalid XML but does +not select the dictionary key for you. + **IMPORTANT :** Always put space after a starting var delimiter and a space before the ending one : Avoid::