diff options
| author | Michael Merickel <michael@merickel.org> | 2012-01-10 22:52:24 -0600 |
|---|---|---|
| committer | wwitzel3 <wayne@pieceofpy.com> | 2012-03-28 11:07:05 -0400 |
| commit | d81ea33ac67ac750053acbfd12616db0130de3c8 (patch) | |
| tree | a8f88343dc1937db789a916f91682fedbc088638 /docs | |
| parent | 2b37513eaf32184ac201e87260a74563a766e245 (diff) | |
| download | pyramid-d81ea33ac67ac750053acbfd12616db0130de3c8.tar.gz pyramid-d81ea33ac67ac750053acbfd12616db0130de3c8.tar.bz2 pyramid-d81ea33ac67ac750053acbfd12616db0130de3c8.zip | |
intermediate commit
Diffstat (limited to 'docs')
| -rw-r--r-- | docs/api/renderers.rst | 2 | ||||
| -rw-r--r-- | docs/narr/renderers.rst | 10 |
2 files changed, 8 insertions, 4 deletions
diff --git a/docs/api/renderers.rst b/docs/api/renderers.rst index 312aa0b31..ea000ad02 100644 --- a/docs/api/renderers.rst +++ b/docs/api/renderers.rst @@ -11,6 +11,8 @@ .. autofunction:: render_to_response +.. autoclass:: JSON + .. autoclass:: JSONP .. attribute:: null_renderer diff --git a/docs/narr/renderers.rst b/docs/narr/renderers.rst index 76035cbdf..47182c09e 100644 --- a/docs/narr/renderers.rst +++ b/docs/narr/renderers.rst @@ -177,8 +177,8 @@ using the API of the ``request.response`` attribute. See .. index:: pair: renderer; JSON -``json``: JSON Renderer -~~~~~~~~~~~~~~~~~~~~~~~ +JSON Renderer +~~~~~~~~~~~~~ The ``json`` renderer renders view callable results to :term:`JSON`. It passes the return value through the ``json.dumps`` standard library function, @@ -207,7 +207,10 @@ representing the JSON serialization of the return value: '{"content": "Hello!"}' The return value needn't be a dictionary, but the return value must contain -values serializable by :func:`json.dumps`. +values serializable by :func:`json.dumps`. Extra arguments can be passed +to :func:`json.dumps` by overriding the default renderer. See +:class:`pyramid.renderers.JSON` and +:ref:`_adding_and_overriding_renderers` for more information. You can configure a view to use the JSON renderer by naming ``json`` as the ``renderer`` argument of a view configuration, e.g. by using @@ -221,7 +224,6 @@ You can configure a view to use the JSON renderer by naming ``json`` as the context='myproject.resources.Hello', renderer='json') - Views which use the JSON renderer can vary non-body response attributes by using the api of the ``request.response`` attribute. See :ref:`request_response_attr`. |
