summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris McDonough <chrism@plope.com>2012-05-03 11:40:45 -0400
committerChris McDonough <chrism@plope.com>2012-05-03 11:40:45 -0400
commitcfabb1bbd36d6614eff6576cd87598de5af376c1 (patch)
treeeaa51e75ccb1f6e474de2444a6085a2c16fdabbd
parenta0bb6b2af64ca27d719d9378b679fb7737e906de (diff)
downloadpyramid-cfabb1bbd36d6614eff6576cd87598de5af376c1.tar.gz
pyramid-cfabb1bbd36d6614eff6576cd87598de5af376c1.tar.bz2
pyramid-cfabb1bbd36d6614eff6576cd87598de5af376c1.zip
garden
-rw-r--r--pyramid/renderers.py18
1 files changed, 11 insertions, 7 deletions
diff --git a/pyramid/renderers.py b/pyramid/renderers.py
index c9ae5b433..c5d33dc16 100644
--- a/pyramid/renderers.py
+++ b/pyramid/renderers.py
@@ -218,11 +218,11 @@ class JSON(object):
self.add_adapter(type, adapter)
def add_adapter(self, type_or_iface, adapter):
- """ When an object of type (or interface) ``type_or_iface`` fails to
- automatically encode using the serializer, the renderer will use the
- adapter ``adapter`` to convert it into a JSON-serializable object.
- The adapter must accept two arguments: the object and the currently
- active request.
+ """ When an object of the type (or interface) ``type_or_iface`` fails
+ to automatically encode using the serializer, the renderer will use
+ the adapter ``adapter`` to convert it into a JSON-serializable
+ object. The adapter must accept two arguments: the object and the
+ currently active request.
.. code-block:: python
@@ -234,7 +234,11 @@ class JSON(object):
renderer = JSON(indent=4)
renderer.add_adapter(Foo, foo_adapter)
- """
+
+ When you've done this, the JSON renderer will be able to serialize
+ instances of the ``Foo`` class when they're encountered in your view
+ results."""
+
self.components.registerAdapter(adapter, (type_or_iface,),
IJSONAdapter)
@@ -301,7 +305,7 @@ class JSONP(JSON):
The arguments passed to this class' constructor mean the same thing as
the arguments passed to :class:`pyramid.renderers.JSON` (including
- ``default``).
+ ``serializer`` and ``adapters``).
Once this renderer is registered via
:meth:`~pyramid.config.Configurator.add_renderer` as above, you can use