From 7a69050837db1a710f91cc3968fdd7271db0ee92 Mon Sep 17 00:00:00 2001 From: Chris McDonough Date: Mon, 21 Dec 2009 12:30:02 +0000 Subject: Use renderer. --- docs/narr/templates.rst | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'docs/narr') 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: -- cgit v1.2.3