summaryrefslogtreecommitdiff
path: root/docs/source/templates.rst
diff options
context:
space:
mode:
authorJonathan LaCour <jonathan@cleverdevil.org>2011-09-02 13:17:51 -0400
committerJonathan LaCour <jonathan@cleverdevil.org>2011-09-02 13:17:51 -0400
commit60296833aec6ba2d54d9e8b1f385f36ac8b01dea (patch)
tree2078e9fa64ba763f27d695360bb5534d22c2add3 /docs/source/templates.rst
parenta748fac872f3e13ebc67df560b1423e81b0e8cba (diff)
downloadpecan-60296833aec6ba2d54d9e8b1f385f36ac8b01dea.tar.gz
Making the template docs better.
Diffstat (limited to 'docs/source/templates.rst')
-rw-r--r--docs/source/templates.rst27
1 files changed, 26 insertions, 1 deletions
diff --git a/docs/source/templates.rst b/docs/source/templates.rst
index d0d5bf2..7ba33e1 100644
--- a/docs/source/templates.rst
+++ b/docs/source/templates.rst
@@ -14,7 +14,15 @@ supports the following templating engines:
* `JSON`
The default template system is `mako`, but can be configured by passing the
-``default_renderer`` key in your app configuration.
+``default_renderer`` key in your app configuration::
+
+ app = {
+ 'default_renderer' : 'kajiki',
+ # ...
+ }
+
+The available renderer type strings are `mako`, `genshi`, `kajiki`, `jinja`,
+and `json`.
Using Renderers
@@ -47,6 +55,23 @@ templating. The first is ``override_template``, which allows you to overrides
which template is used in your controller, and the second is ``render``, which
allows you to manually render output using the Pecan templating framework.
+To use ``override_template``, simply call it within the body of your controller
+
+::
+
+ class MyController(object):
+ @expose('template_one.html')
+ def index(self):
+ # ...
+ override_template('template_two.html')
+ return dict(message='I will now render with template_two.html')
+
+The ``render`` helper is also quite simple to use::
+
+ @expose()
+ def controller(self):
+ return render('my_template.html', dict(message='I am the namespace'))
+
The JSON Renderer
-----------------