summaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
authorTres Seaver <tseaver@palladion.com>2013-01-29 09:10:30 -0800
committerTres Seaver <tseaver@palladion.com>2013-01-29 09:10:30 -0800
commit53460a00c726186c605280958c88a82dd31aec83 (patch)
tree846663578bb002a8edd3b83f4e17c685f1241acb /docs
parenta1df4e5124e7dcef573d1ae8938173f49f145e6d (diff)
parent531a2ad34ab0a806513681cddd5d99e50a31c4c6 (diff)
downloadpyramid-53460a00c726186c605280958c88a82dd31aec83.tar.gz
pyramid-53460a00c726186c605280958c88a82dd31aec83.tar.bz2
pyramid-53460a00c726186c605280958c88a82dd31aec83.zip
Merge pull request #817 from tshepang/renderers
some improvements to narrative docs of Renderers
Diffstat (limited to 'docs')
-rw-r--r--docs/narr/renderers.rst29
1 files changed, 8 insertions, 21 deletions
diff --git a/docs/narr/renderers.rst b/docs/narr/renderers.rst
index 794e3cffa..863932e83 100644
--- a/docs/narr/renderers.rst
+++ b/docs/narr/renderers.rst
@@ -63,7 +63,6 @@ the ``renderer`` attribute. For example, this call to
with a view callable:
.. code-block:: python
- :linenos:
config.add_view('myproject.views.my_view', renderer='json')
@@ -166,7 +165,6 @@ The body of the response returned by such a view will be a string
representing the ``str()`` serialization of the return value:
.. code-block:: python
- :linenos:
{'content': 'Hello!'}
@@ -204,7 +202,6 @@ The body of the response returned by such a view will be a string
representing the JSON serialization of the return value:
.. code-block:: python
- :linenos:
'{"content": "Hello!"}'
@@ -294,9 +291,8 @@ with the object.
See :class:`pyramid.renderers.JSON` and
:ref:`adding_and_overriding_renderers` for more information.
-.. note::
-
- Serializing custom objects is a feature new in Pyramid 1.4.
+.. versionadded:: 1.4
+ Serializing custom objects.
.. index::
pair: renderer; JSONP
@@ -306,9 +302,7 @@ See :class:`pyramid.renderers.JSON` and
JSONP Renderer
~~~~~~~~~~~~~~
-.. note::
-
- This feature is new in Pyramid 1.1.
+.. versionadded:: 1.1
:class:`pyramid.renderers.JSONP` is a `JSONP
<http://en.wikipedia.org/wiki/JSONP>`_ renderer factory helper which
@@ -571,7 +565,8 @@ in :ref:`request_module`. For more information on the API of
Deprecated Mechanism to Vary Attributes of Rendered Responses
-------------------------------------------------------------
-.. warning:: This section describes behavior deprecated in Pyramid 1.1.
+.. deprecated:: 1.1
+ The behavior described in this entire section.
In previous releases of Pyramid (1.0 and before), the ``request.response``
attribute did not exist. Instead, Pyramid required users to set special
@@ -619,7 +614,6 @@ For example, to add a renderer which renders views which have a
``renderer`` attribute that is a path that ends in ``.jinja2``:
.. code-block:: python
- :linenos:
config.add_renderer('.jinja2', 'mypackage.MyJinja2Renderer')
@@ -689,12 +683,10 @@ There are essentially two different kinds of renderer factories:
:term:`package`.
Here's an example of the registration of a simple renderer factory via
-:meth:`~pyramid.config.Configurator.add_renderer`:
+:meth:`~pyramid.config.Configurator.add_renderer`, where ``config``
+is an instance of :meth:`pyramid.config.Configurator`:
.. code-block:: python
- :linenos:
-
- # config is an instance of pyramid.config.Configurator
config.add_renderer(name='amf', factory='my.package.MyAMFRenderer')
@@ -725,10 +717,8 @@ Here's an example of the registration of a more complicated renderer
factory, which expects to be passed a filesystem path:
.. code-block:: python
- :linenos:
- config.add_renderer(name='.jinja2',
- factory='my.package.MyJinja2Renderer')
+ config.add_renderer(name='.jinja2', factory='my.package.MyJinja2Renderer')
Adding the above code to your application startup will allow you to use the
``my.package.MyJinja2Renderer`` renderer factory implementation in view
@@ -769,7 +759,6 @@ extension for the same kinds of templates. For example, to associate the
:meth:`pyramid.config.Configurator.add_renderer` method:
.. code-block:: python
- :linenos:
config.add_renderer('.zpt', 'pyramid.chameleon_zpt.renderer_factory')
@@ -781,7 +770,6 @@ rendered via a Chameleon ZPT page template renderer, use a variation on the
following in your application's startup code:
.. code-block:: python
- :linenos:
config.add_renderer('.pt', 'mypackage.pt_renderer')
@@ -794,7 +782,6 @@ ones which do not possess a ``renderer`` attribute), pass ``None`` as
the ``name`` attribute to the renderer tag:
.. code-block:: python
- :linenos:
config.add_renderer(None, 'mypackage.json_renderer_factory')