diff options
| author | Tshepang Lekhonkhobe <tshepang@gmail.com> | 2013-01-25 01:15:10 +0200 |
|---|---|---|
| committer | Tshepang Lekhonkhobe <tshepang@gmail.com> | 2013-01-25 01:15:10 +0200 |
| commit | 00cee701066fc558d0becfa3bade7ce282600d6e (patch) | |
| tree | 77179070473f6ee621188befe01f6028fca067e8 | |
| parent | e74345205792070d85739ad447f68f1276d3e074 (diff) | |
| download | pyramid-00cee701066fc558d0becfa3bade7ce282600d6e.tar.gz pyramid-00cee701066fc558d0becfa3bade7ce282600d6e.tar.bz2 pyramid-00cee701066fc558d0becfa3bade7ce282600d6e.zip | |
be a little more concise
| -rw-r--r-- | pyramid/renderers.py | 35 |
1 files 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() |
