summaryrefslogtreecommitdiff
path: root/docs/narr/templates.rst
diff options
context:
space:
mode:
authorChris McDonough <chrism@plope.com>2010-12-18 02:27:14 -0500
committerChris McDonough <chrism@plope.com>2010-12-18 02:27:14 -0500
commitfb6a5ce52a275f7798e82a34b5907ea118cbd2ff (patch)
tree29e80d0eb681676d1e0eb2707ca764dbf5491864 /docs/narr/templates.rst
parentbf89764a7e3ccab6133c9ad43b8d9af4f5c4083b (diff)
downloadpyramid-fb6a5ce52a275f7798e82a34b5907ea118cbd2ff.tar.gz
pyramid-fb6a5ce52a275f7798e82a34b5907ea118cbd2ff.tar.bz2
pyramid-fb6a5ce52a275f7798e82a34b5907ea118cbd2ff.zip
model -> resource; resource -> asset
Diffstat (limited to 'docs/narr/templates.rst')
-rw-r--r--docs/narr/templates.rst29
1 files changed, 14 insertions, 15 deletions
diff --git a/docs/narr/templates.rst b/docs/narr/templates.rst
index 09b9bfc51..d6c21831e 100644
--- a/docs/narr/templates.rst
+++ b/docs/narr/templates.rst
@@ -468,20 +468,19 @@ works in these templates.
Using ZPT Macros in :app:`Pyramid`
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-When a :term:`renderer` is used to render a template, :app:`Pyramid`
-makes at least two top-level names available to the template by default:
-``context`` and ``request``. One of the common needs in ZPT-based
-templates is to use one template's "macros" from within a different
-template. In Zope, this is typically handled by retrieving the template
-from the ``context``. But the context in :app:`Pyramid` is typically a
-model object, and templates cannot usually be retrieved from models. To
-use macros in :app:`Pyramid`, you need to make the macro template itself
-available to the rendered template by passing the macro template, or
-even the macro itself, *into* the rendered template. To do this you can
-use the :func:`pyramid.renderers.get_renderer` API to retrieve the macro
-template, and pass it into the template being rendered via the dictionary
-returned by the view. For example, using a :term:`view configuration` via a
-:class:`pyramid.view.view_config` decorator that uses a
+When a :term:`renderer` is used to render a template, :app:`Pyramid` makes at
+least two top-level names available to the template by default: ``context``
+and ``request``. One of the common needs in ZPT-based templates is to use
+one template's "macros" from within a different template. In Zope, this is
+typically handled by retrieving the template from the ``context``. But the
+context in :app:`Pyramid` is a resource object, and templates cannot usually
+be retrieved from resources. To use macros in :app:`Pyramid`, you need to make
+the macro template itself available to the rendered template by passing the
+macro template, or even the macro itself, *into* the rendered template. To
+do this you can use the :func:`pyramid.renderers.get_renderer` API to
+retrieve the macro template, and pass it into the template being rendered via
+the dictionary returned by the view. For example, using a :term:`view
+configuration` via a :class:`pyramid.view.view_config` decorator that uses a
:term:`renderer`:
.. code-block:: python
@@ -658,7 +657,7 @@ on, an exception resulting from the same problem might end like so:
request: <Request - at 0x1d2ecd0>
project: proj
macros: <Macros - at 0x1d3aed0>
- context: <MyModel None at 0x1d39130>
+ context: <MyResource None at 0x1d39130>
view: <function my_view at 0x1d23570>
NameError: wrong