summaryrefslogtreecommitdiff
path: root/docs/narr/templates.rst
diff options
context:
space:
mode:
authorBlaise Laflamme <blaise@laflamme.org>2012-06-19 20:12:55 -0400
committerBlaise Laflamme <blaise@laflamme.org>2012-06-19 20:12:55 -0400
commitea009a6d4a1ffa8585faa85581848f6e74a57dfc (patch)
tree3ef83c62d129b58d78f06cf9ba2b24f3ce447bd2 /docs/narr/templates.rst
parentb015d702d4c5367cd24fa05bd8d83462b6d59ac1 (diff)
downloadpyramid-ea009a6d4a1ffa8585faa85581848f6e74a57dfc.tar.gz
pyramid-ea009a6d4a1ffa8585faa85581848f6e74a57dfc.tar.bz2
pyramid-ea009a6d4a1ffa8585faa85581848f6e74a57dfc.zip
added docs and changes for using defs in mako renderer
Diffstat (limited to 'docs/narr/templates.rst')
-rw-r--r--docs/narr/templates.rst16
1 files changed, 16 insertions, 0 deletions
diff --git a/docs/narr/templates.rst b/docs/narr/templates.rst
index 9db0b1c4d..4ac01c96e 100644
--- a/docs/narr/templates.rst
+++ b/docs/narr/templates.rst
@@ -714,6 +714,22 @@ This template doesn't use any advanced features of Mako, only the
:term:`renderer globals`. See the `the Mako documentation
<http://www.makotemplates.org/>`_ to use more advanced features.
+Using def inside Mako Templates
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+To use a def inside a Mako template, given a :term:`Mako` template file named
+``foo.mak`` and a def named ``bar``, you can configure the template as a
+:term:`renderer` like so:
+
+.. code-block:: python
+ :linenos:
+
+ from pyramid.view import view_config
+
+ @view_config(renderer='foo#defname.mak')
+ def my_view(request):
+ return {'project':'my project'}
+
.. index::
single: automatic reloading of templates
single: template automatic reload