From: Armin Ronacher Date: Sat, 17 May 2008 12:17:15 +0000 (+0200) Subject: removed esection about Jinja semantics as we don't have local aliasing currently X-Git-Tag: 2.0rc1~47 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=dd65ef46071ab1dd77b632251d46475253b2a4bd;p=jinja2.git removed esection about Jinja semantics as we don't have local aliasing currently --HG-- branch : trunk --- diff --git a/docs/api.rst b/docs/api.rst index 10e497f..5b9e5ad 100644 --- a/docs/api.rst +++ b/docs/api.rst @@ -369,32 +369,3 @@ context. This is the place where you can put variables and functions that should be available all the time. Additionally :attr:`Template.globals` exist that are variables available to a specific template that are available to all :meth:`~Template.render` calls. - - -Jinja2 Semantics ----------------- - -Jinja2 behaves like regular Python code in the runtime with some additional -restrictions that allow the template engine to optimize some common idoms. -The context is semi immutable. Only Jinja2 itself may modify it, if other -code (such as :func:`contextfunction`\s) modify it the changes won't show up -as expected. - -Another change to regular Python is that Jinja2 sees attributes as immutable. -It assumes that every time it accesses `foo.bar`, bar will look the same as -long as `foo` was not overriden. In some situations Jinja will take advantage -of that to internally substitute continuous lookups to the same attributes -with a copy of the attribute. - -For example in the following template the `post.user` attribute is looked up -once: - -.. sourcecode:: html+jinja - - {% if post.user %} -

{{ post.user.username }}

-

Location: {{ post.user.location }}

- {% endif %} - -That said, the objects passed to the template may not generate different -values every time a property is accessed.