From e74345205792070d85739ad447f68f1276d3e074 Mon Sep 17 00:00:00 2001 From: Tshepang Lekhonkhobe Date: Fri, 25 Jan 2013 01:12:30 +0200 Subject: typo --- pyramid/renderers.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyramid/renderers.py b/pyramid/renderers.py index 6839d72f5..98c84451d 100644 --- a/pyramid/renderers.py +++ b/pyramid/renderers.py @@ -70,7 +70,7 @@ def render(renderer_name, value, request=None, package=None): top-level system names, such as ``request``, ``context``, ``renderer_name``, and ``view``. See :ref:`renderer_system_values` for the full list. If :term:`renderer globals` have been specified, these - will also be used to agument the value. + will also be used to augment the value. Supply a ``request`` parameter in order to provide the renderer with the most correct 'system' values (``request`` and ``context`` -- cgit v1.2.3 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 From 05e928bd9755614b0edbac0ab3b6d6b7fbbd0f17 Mon Sep 17 00:00:00 2001 From: Tshepang Lekhonkhobe Date: Sun, 27 Jan 2013 11:08:26 +0200 Subject: make use of 'versionadded' and 'deprecated' directives in pyramid.view --- pyramid/view.py | 23 +++++++++-------------- 1 file changed, 9 insertions(+), 14 deletions(-) diff --git a/pyramid/view.py b/pyramid/view.py index 40d7c19b9..8e3292274 100644 --- a/pyramid/view.py +++ b/pyramid/view.py @@ -29,9 +29,11 @@ _marker = object() class static(static_view): """ Backwards compatibility alias for :class:`pyramid.static.static_view`; it overrides that class' constructor - to pass ``use_subpath=True`` by default. This class is deprecated as of - :app:`Pyramid` 1.1. Use :class:`pyramid.static.static_view` instead - (probably with a ``use_subpath=True`` argument). + to pass ``use_subpath=True`` by default. + + .. deprecated:: 1.1 + use :class:`pyramid.static.static_view` instead + (probably with a ``use_subpath=True`` argument) """ def __init__(self, root_dir, cache_max_age=3600, package_name=None): if package_name is None: @@ -312,6 +314,7 @@ See also :ref:`changing_the_notfound_view`. class notfound_view_config(object): """ + .. versionadded:: 1.3 An analogue of :class:`pyramid.view.view_config` which registers a :term:`not found view`. @@ -346,9 +349,6 @@ class notfound_view_config(object): See :ref:`changing_the_notfound_view` for detailed usage information. - .. note:: - - This class is new as of Pyramid 1.3. """ venusian = venusian @@ -377,6 +377,7 @@ class notfound_view_config(object): class forbidden_view_config(object): """ + .. versionadded:: 1.3 An analogue of :class:`pyramid.view.view_config` which registers a :term:`forbidden view`. @@ -403,9 +404,6 @@ class forbidden_view_config(object): See :ref:`changing_the_forbidden_view` for detailed usage information. - .. note:: - - This class is new as of Pyramid 1.3. """ venusian = venusian @@ -436,11 +434,8 @@ def is_response(ob): """ Return ``True`` if ``ob`` implements the interface implied by :ref:`the_response`. ``False`` if not. - .. warning:: - - This function is deprecated as of :app:`Pyramid` 1.1. New - code should not use it. Instead, new code should use the - :func:`pyramid.request.Request.is_response` method.""" + .. deprecated:: 1.1 + use :func:`pyramid.request.Request.is_response` instead""" if ( hasattr(ob, 'app_iter') and hasattr(ob, 'headerlist') and hasattr(ob, 'status') ): return True -- cgit v1.2.3 From 3c5dc535334269eab0769f8421555733ca34ecf2 Mon Sep 17 00:00:00 2001 From: Tshepang Lekhonkhobe Date: Sun, 27 Jan 2013 11:09:41 +0200 Subject: capitalize --- pyramid/view.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyramid/view.py b/pyramid/view.py index 8e3292274..f315b5495 100644 --- a/pyramid/view.py +++ b/pyramid/view.py @@ -317,7 +317,7 @@ class notfound_view_config(object): .. versionadded:: 1.3 An analogue of :class:`pyramid.view.view_config` which registers a - :term:`not found view`. + :term:`Not Found View`. The notfound_view_config constructor accepts most of the same arguments as the constructor of :class:`pyramid.view.view_config`. It can be used -- cgit v1.2.3 From e450cad6ad7e1f75610827e96e56b18b44869626 Mon Sep 17 00:00:00 2001 From: Tshepang Lekhonkhobe Date: Sun, 27 Jan 2013 11:09:58 +0200 Subject: add missing markup --- pyramid/view.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyramid/view.py b/pyramid/view.py index f315b5495..b88c2ea85 100644 --- a/pyramid/view.py +++ b/pyramid/view.py @@ -319,7 +319,7 @@ class notfound_view_config(object): An analogue of :class:`pyramid.view.view_config` which registers a :term:`Not Found View`. - The notfound_view_config constructor accepts most of the same arguments + The ``notfound_view_config`` constructor accepts most of the same arguments as the constructor of :class:`pyramid.view.view_config`. It can be used in the same places, and behaves in largely the same way, except it always registers a not found exception view instead of a 'normal' view. -- cgit v1.2.3