Skip to content

Commit a6e603a

Browse files
author
Richard Jones
committed
more useful example
1 parent 9201745 commit a6e603a

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

doc/templating.txt

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
HTML Templating Mechanisms
33
==========================
44

5-
:Version: $Revision: 1.7 $
5+
:Version: $Revision: 1.8 $
66

77
Current Situation and Issues
88
============================
@@ -104,11 +104,12 @@ TALES - TAL Expression Language
104104
that form the tag attribute values. TALES expressions come in three
105105
flavours:
106106

107-
Path Expressions - eg. ``foo/bar/frozz``
107+
Path Expressions - eg. ``item/status/checklist``
108108
These are object attribute / item accesses. Roughly speaking, the path
109-
``foo/bar/frozz`` is broken into parts ``foo``, ``bar`` and ``frozz``. The
110-
``foo`` part is the root of the expression. We then look for a ``bar``
111-
attribute on foo, or failing that, a bar item (as in foo['bar']). If that
109+
``item/status/checklist`` is broken into parts ``item``, ``status``
110+
and ``checklist``. The ``item`` part is the root of the expression.
111+
We then look for a ``status`` attribute on ``item``, or failing that, a
112+
``status`` item (as in ``item['status']``). If that
112113
fails, the path expression fails. When we get to the end, the object we're
113114
left with is evaluated to get a string - methods are called, objects are
114115
stringified. Path expressions may have an optional ``path:`` prefix, though
@@ -121,8 +122,9 @@ TALES - TAL Expression Language
121122

122123
Python Expressions - eg. ``python: 1+1``
123124
These expressions give the full power of Python. All the "root level"
124-
variables are available, so ``python:foo.bar.frozz()`` might be equivalent
125-
to ``foo/bar/frozz``, assuming that ``frozz`` is a method.
125+
variables are available, so ``python:item.status.checklist()`` would be
126+
equivalent to ``item/status/checklist``, assuming that ``checklist`` is
127+
a method.
126128

127129
PageTemplates
128130
The PageTemplates module glues together TAL and TALES.

0 commit comments

Comments
 (0)