diff options
| author | Chris McDonough <chrism@agendaless.com> | 2008-08-17 17:32:54 +0000 |
|---|---|---|
| committer | Chris McDonough <chrism@agendaless.com> | 2008-08-17 17:32:54 +0000 |
| commit | 0e21c22166f5160a2a64fad714d69d81897ef7d3 (patch) | |
| tree | 6a576d0edfafe0e204a1770c094f13ff8aa74487 /docs/narr/project.rst | |
| parent | 157721dda97f5aea95f40e307d9d5dceb1014f83 (diff) | |
| download | pyramid-0e21c22166f5160a2a64fad714d69d81897ef7d3.tar.gz pyramid-0e21c22166f5160a2a64fad714d69d81897ef7d3.tar.bz2 pyramid-0e21c22166f5160a2a64fad714d69d81897ef7d3.zip | |
- Add ``<bfg:settings>`` directive. This directive currently allows
only one attribute: ``reload_templates``. If e.g.::
<bfg:settings reload_templates="true"/>
is in your application's ZCML, you will not need to restart the
appserver in order for ``z3c.pt`` or XSLT template changes to be
detected and displayed.
Diffstat (limited to 'docs/narr/project.rst')
| -rw-r--r-- | docs/narr/project.rst | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/docs/narr/project.rst b/docs/narr/project.rst index f93dd2a88..98f02a476 100644 --- a/docs/narr/project.rst +++ b/docs/narr/project.rst @@ -416,7 +416,10 @@ registry`. It looks like so: #. Line 6 initializes :mod:`repoze.bfg`-specific configuration directives by including it as a package. -#. Lines 8-11 register a single view. It is ``for`` model objects +#. Line 10 tells :mod:`repoze.bfg` to detect changes made to + ``z3c.pt`` and XSLT templates immediately. + +#. Lines 12-15 register a single view. It is ``for`` model objects that support the IMyModel interface. The ``view`` attribute points at a Python function that does all the work for this view. Note that the values of both the ``for`` attribute and the ``view`` @@ -451,7 +454,16 @@ in the model, and the HTML given back to the browser. ``Request`` class representing the browser's request to our server. #. The view renders a :term:`template` and returns the result as the - :term:`response`. + :term:`response`. Note that because our ``configure.zcml`` has a + ``bfg:settings`` directive indicating that templates should be + reloaded when they change, you won't need to restart the + application server to see changes you make to templates. During + development, this is handy. If this directive had been ``false`` + (or if the directive did not exist), you would need to restart the + application server for each template change. For production + applications, you should set your ``bfg:settings`` + ``reload_templates`` to ``false`` to increase the speed at which + templates may be rendered. .. note:: @@ -460,7 +472,9 @@ in the model, and the HTML given back to the browser. the ``render_template`` function, also present in :ref:`template_module`. You may then create your own :term:`WebOb` Response object, using the result of ``render_template`` as the - response's body. + response's body. There is also a ``get_template`` API in the same + module, which you can use to retrieve the template object without + rendering it at all, for additional control. ``models.py`` ~~~~~~~~~~~~~ |
