From 00cee701066fc558d0becfa3bade7ce282600d6e Mon Sep 17 00:00:00 2001 From: Tshepang Lekhonkhobe Date: Fri, 25 Jan 2013 01:15:10 +0200 Subject: be a little more concise --- pyramid/renderers.py | 35 +++++++++++++++++------------------ 1 file changed, 17 insertions(+), 18 deletions(-) diff --git a/pyramid/renderers.py b/pyramid/renderers.py index 98c84451d..6310b7fee 100644 --- a/pyramid/renderers.py +++ b/pyramid/renderers.py @@ -43,23 +43,23 @@ from pyramid.threadlocal import get_current_registry # API def render(renderer_name, value, request=None, package=None): - """ Using the renderer specified as ``renderer_name`` (a template - or a static renderer) render the value (or set of values) present + """ Using the renderer ``renderer_name`` (a template + or a static renderer), render the value (or set of values) present in ``value``. Return the result of the renderer's ``__call__`` method (usually a string or Unicode). - If the renderer name refers to a file on disk (such as when the - renderer is a template), it's usually best to supply the name as a + If the ``renderer_name`` refers to a file on disk, such as when the + renderer is a template, it's usually best to supply the name as an :term:`asset specification` (e.g. ``packagename:path/to/template.pt``). You may supply a relative asset spec as ``renderer_name``. If the ``package`` argument is supplied, a relative renderer path will be converted to an absolute asset specification by - combining the package supplied as ``package`` with the relative - asset specification supplied as ``renderer_name``. If you do - not supply a ``package`` (or ``package`` is ``None``) the package - name of the *caller* of this function will be used as the package. + combining the package ``package`` with the relative + asset specification ``renderer_name``. If ``package`` + is ``None`` (the default), the package name of the *caller* of + this function will be used as the package. The ``value`` provided will be supplied as the input to the renderer. Usually, for template renderings, this should be a @@ -88,8 +88,8 @@ def render(renderer_name, value, request=None, package=None): return helper.render(value, None, request=request) def render_to_response(renderer_name, value, request=None, package=None): - """ Using the renderer specified as ``renderer_name`` (a template - or a static renderer) render the value (or set of values) using + """ Using the renderer ``renderer_name`` (a template + or a static renderer), render the value (or set of values) using the result of the renderer's ``__call__`` method (usually a string or Unicode) as the response body. @@ -100,8 +100,8 @@ def render_to_response(renderer_name, value, request=None, package=None): You may supply a relative asset spec as ``renderer_name``. If the ``package`` argument is supplied, a relative renderer name will be converted to an absolute asset specification by - combining the package supplied as ``package`` with the relative - asset specification supplied as ``renderer_name``. If you do + combining the package ``package`` with the relative + asset specification ``renderer_name``. If you do not supply a ``package`` (or ``package`` is ``None``) the package name of the *caller* of this function will be used as the package. @@ -134,16 +134,15 @@ def render_to_response(renderer_name, value, request=None, package=None): return helper.render_to_response(value, None, request=request) def get_renderer(renderer_name, package=None): - """ Return the renderer object for the renderer named as - ``renderer_name``. + """ Return the renderer object for the renderer ``renderer_name``. You may supply a relative asset spec as ``renderer_name``. If the ``package`` argument is supplied, a relative renderer name will be converted to an absolute asset specification by - combining the package supplied as ``package`` with the relative - asset specification supplied as ``renderer_name``. If you do - not supply a ``package`` (or ``package`` is ``None``) the package - name of the *caller* of this function will be used as the package. + combining the package ``package`` with the relative + asset specification ``renderer_name``. If ``package`` is ``None`` + (the default), the package name of the *caller* of this function + will be used as the package. """ if package is None: package = caller_package() -- cgit v1.2.3