diff options
| author | Chris McDonough <chrism@agendaless.com> | 2009-12-21 12:30:02 +0000 |
|---|---|---|
| committer | Chris McDonough <chrism@agendaless.com> | 2009-12-21 12:30:02 +0000 |
| commit | 7a69050837db1a710f91cc3968fdd7271db0ee92 (patch) | |
| tree | 2aeeff29f77270461ecfb8ba6fcb3406802d0177 /docs | |
| parent | 11c0b5e8f44986145a384b466952108b462b10f9 (diff) | |
| download | pyramid-7a69050837db1a710f91cc3968fdd7271db0ee92.tar.gz pyramid-7a69050837db1a710f91cc3968fdd7271db0ee92.tar.bz2 pyramid-7a69050837db1a710f91cc3968fdd7271db0ee92.zip | |
Use renderer.
Diffstat (limited to 'docs')
| -rw-r--r-- | docs/narr/templates.rst | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/docs/narr/templates.rst b/docs/narr/templates.rst index 4417ffcd5..6a42bcf49 100644 --- a/docs/narr/templates.rst +++ b/docs/narr/templates.rst @@ -135,17 +135,19 @@ itself available to the rendered template by passing template in which the macro is defined (or even the macro itself) into the rendered template. To make a macro available to the rendered template, you can retrieve a different template using the ``get_template`` API, and pass -it in to the template being rendered. For example: +it in to the template being rendered. For example, using a +:term:`view configuration` via a ``@bfg_view`` decorator that uses a +:term:`renderer`: .. code-block:: python :linenos: - from repoze.bfg.chameleon_zpt import render_template_to_response from repoze.bfg.chameleon_zpt import get_template + @bfg_view(renderer='templates/mytemplate.pt') def my_view(request): main = get_template('templates/master.pt') - return render_template_to_response('templates/mytemplate.pt', main=main) + return {'main':main} Where ``templates/master.pt`` might look like so: |
