diff options
| author | Chris McDonough <chrism@plope.com> | 2012-07-29 10:01:40 -0400 |
|---|---|---|
| committer | Chris McDonough <chrism@plope.com> | 2012-07-29 10:01:40 -0400 |
| commit | d204b348535e4f28df4d59d25aa9b493306d41e5 (patch) | |
| tree | 8027ef04a07bd0c01f60d347d8fca2ec4d8acc7c /docs/narr/templates.rst | |
| parent | c7fcdf1665cfdc1173559baa0a56d9a06fcba448 (diff) | |
| parent | 14f9fe44ec75c055d89374a7852e1ca2af0ff31c (diff) | |
| download | pyramid-d204b348535e4f28df4d59d25aa9b493306d41e5.tar.gz pyramid-d204b348535e4f28df4d59d25aa9b493306d41e5.tar.bz2 pyramid-d204b348535e4f28df4d59d25aa9b493306d41e5.zip | |
Merge branch 'master' of github.com:Pylons/pyramid
Diffstat (limited to 'docs/narr/templates.rst')
| -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 |
