summaryrefslogtreecommitdiff
path: root/docs/narr/templates.rst
diff options
context:
space:
mode:
authorMichael Merickel <michael@merickel.org>2012-08-16 00:59:18 -0500
committerMichael Merickel <michael@merickel.org>2012-08-16 00:59:18 -0500
commit717537cdd6611511f783542034f00cf0099d515e (patch)
tree1f0a28530836a647713c22f2dd91767270f42458 /docs/narr/templates.rst
parenta54b5e46f63ff3154c5d9f191ad3b78a2f506a8a (diff)
parent6b180cbb77d6c5bee0e75220d93fc1800d1217df (diff)
downloadpyramid-717537cdd6611511f783542034f00cf0099d515e.tar.gz
pyramid-717537cdd6611511f783542034f00cf0099d515e.tar.bz2
pyramid-717537cdd6611511f783542034f00cf0099d515e.zip
Merge branch 'master' into feature.instance-properties
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..860010a1a 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#bar.mak')
+ def my_view(request):
+ return {'project':'my project'}
+
.. index::
single: automatic reloading of templates
single: template automatic reload