diff options
| author | Chris McDonough <chrism@plope.com> | 2012-06-19 21:41:42 -0400 |
|---|---|---|
| committer | Chris McDonough <chrism@plope.com> | 2012-06-19 21:41:42 -0400 |
| commit | a5d9fb4fe86ed7d3da785af6b8b8e82e21d7ae63 (patch) | |
| tree | 23760cfe4cf86ea1a7d754a8826c5489f3cae5f8 /docs | |
| parent | 3da92290bfaa8b4072019c916e75cd96ebc0f6dc (diff) | |
| parent | c2d65ff71dac6a9b15119db8c2fb09884f4060e3 (diff) | |
| download | pyramid-a5d9fb4fe86ed7d3da785af6b8b8e82e21d7ae63.tar.gz pyramid-a5d9fb4fe86ed7d3da785af6b8b8e82e21d7ae63.tar.bz2 pyramid-a5d9fb4fe86ed7d3da785af6b8b8e82e21d7ae63.zip | |
Merge branch 'master' of github.com:Pylons/pyramid
Diffstat (limited to 'docs')
| -rw-r--r-- | docs/narr/templates.rst | 16 |
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 |
