Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Merge pull request #2776 from stevepiercy/master
Clean up docstrings/narr docs from PR #2660
  • Loading branch information
stevepiercy committed Sep 29, 2016
2 parents 9060dff + 0fdafb4 commit 2058b2e
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 22 deletions.
10 changes: 5 additions & 5 deletions docs/narr/viewconfig.rst
Expand Up @@ -307,8 +307,8 @@ configured view.
interface; it is otherwise false.

It is possible to pass an exception class as the context if your context may
subclass an exception. In this case **two** views will be registered. One
will match normal incoming requests and the other will match as an
subclass an exception. In this case *two* views will be registered. One
will match normal incoming requests, and the other will match as an
:term:`exception view` which only occurs when an exception is raised during
the normal request processing pipeline.

Expand All @@ -317,11 +317,11 @@ configured view.

``exception_only``

When this value is ``True`` the ``context`` argument must be a subclass of
When this value is ``True``, the ``context`` argument must be a subclass of
``Exception``. This flag indicates that only an :term:`exception view` should
be created and that this view should not match if the traversal
be created, and that this view should not match if the traversal
:term:`context` matches the ``context`` argument. If the ``context`` is a
subclass of ``Exception`` and this value is ``False`` (the default) then a
subclass of ``Exception`` and this value is ``False`` (the default), then a
view will be registered to match the traversal :term:`context` as well.

.. versionadded:: 1.8
Expand Down
6 changes: 3 additions & 3 deletions docs/narr/views.rst
Expand Up @@ -262,13 +262,13 @@ specialized views as described in :ref:`special_exceptions_in_callables` can
also be used by application developers to convert arbitrary exceptions to
responses.

To register a :term:`exception view` that should be called whenever a
To register an :term:`exception view` that should be called whenever a
particular exception is raised from within :app:`Pyramid` view code, use
:meth:`pyramid.config.Configurator.add_exception_view` to register a view
configuration which matches the exception (or a subclass of the exception) and
points at a view callable for which you'd like to generate a response. The
exception will be passed as the ``context`` argument to any
:term:`view predicate` registered with the view as well as to the view itself.
:term:`view predicate` registered with the view, as well as to the view itself.
For convenience a new decorator exists,
:class:`pyramid.views.exception_view_config`, which may be used to easily
register exception views.
Expand Down Expand Up @@ -334,7 +334,7 @@ which have a name will be ignored.

In most cases, you should register an :term:`exception view` by using
:meth:`pyramid.config.Configurator.add_exception_view`. However, it is
possible to register 'normal' (i.e., non-exception) views against a context
possible to register "normal" (i.e., non-exception) views against a context
resource type which inherits from :exc:`Exception` (i.e.,
``config.add_view(context=Exception)``). When the view configuration is
processed, *two* views are registered. One as a "normal" view, the other
Expand Down
22 changes: 11 additions & 11 deletions pyramid/config/views.py
Expand Up @@ -502,19 +502,19 @@ def wrapper(context, request):
if the :term:`context` provides the represented interface;
it is otherwise false. This argument may also be provided
to ``add_view`` as ``for_`` (an older, still-supported
spelling). If the view should **only** match when handling
exceptions then set the ``exception_only`` to ``True``.
spelling). If the view should *only* match when handling
exceptions, then set the ``exception_only`` to ``True``.
exception_only
.. versionadded:: 1.8
When this value is ``True`` the ``context`` argument must be
When this value is ``True``, the ``context`` argument must be
a subclass of ``Exception``. This flag indicates that only an
:term:`exception view` should be created and that this view should
:term:`exception view` should be created, and that this view should
not match if the traversal :term:`context` matches the ``context``
argument. If the ``context`` is a subclass of ``Exception`` and
this value is ``False`` (the default) then a view will be
this value is ``False`` (the default), then a view will be
registered to match the traversal :term:`context` as well.
route_name
Expand Down Expand Up @@ -908,7 +908,7 @@ def register(permission=permission, renderer=renderer):
# allow failure of registered template factories to be deferred
# until view execution, like other bad renderer factories; if
# we tried to relate this to an existing renderer factory
# without checking if it the factory actually existed, we'd end
# without checking if the factory actually existed, we'd end
# up with a KeyError at startup time, which is inconsistent
# with how other bad renderer registrations behave (they throw
# a ValueError at view execution time)
Expand Down Expand Up @@ -1458,7 +1458,7 @@ def forbidden(request):
view will be invoked. Unlike
:meth:`pyramid.config.Configurator.add_view`, this method will raise
an exception if passed ``name``, ``permission``, ``require_csrf``,
``context``, ``for_`` or ``exception_only`` keyword arguments. These
``context``, ``for_``, or ``exception_only`` keyword arguments. These
argument values make no sense in the context of a forbidden
:term:`exception view`.
Expand Down Expand Up @@ -1534,7 +1534,7 @@ def add_notfound_view(
):
""" Add a default :term:`Not Found View` to the current configuration
state. The view will be called when Pyramid or application code raises
an :exc:`pyramid.httpexceptions.HTTPNotFound` exception (e.g. when a
an :exc:`pyramid.httpexceptions.HTTPNotFound` exception (e.g., when a
view cannot be found for the request). The simplest example is:
.. code-block:: python
Expand Down Expand Up @@ -1656,11 +1656,11 @@ def add_exception_view(
the current configuration state. The view will be called when Pyramid
or application code raises the given exception.
This method accepts accepts almost all of the same arguments as
This method accepts almost all of the same arguments as
:meth:`pyramid.config.Configurator.add_view` except for ``name``,
``permission``, ``for_``, ``require_csrf`` and ``exception_only``.
``permission``, ``for_``, ``require_csrf``, and ``exception_only``.
By default, this method will set ``context=Exception`` thus
By default, this method will set ``context=Exception``, thus
registering for most default Python exceptions. Any subclass of
``Exception`` may be specified.
Expand Down
6 changes: 3 additions & 3 deletions pyramid/view.py
Expand Up @@ -480,7 +480,7 @@ class exception_view_config(object):
and additionally 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 an
exception view instead of a 'normal' view that dispatches on the request
exception view instead of a "normal" view that dispatches on the request
:term:`context`.
Example:
Expand All @@ -495,7 +495,7 @@ def error_view(request):
return {'error': str(request.exception)}
All arguments passed to this function have the same meaning as
:meth:`pyramid.view.view_config` and each predicate argument restricts
:meth:`pyramid.view.view_config`, and each predicate argument restricts
the set of circumstances under which this exception view will be invoked.
"""
Expand All @@ -521,7 +521,7 @@ def callback(context, name, ob):
if info.scope == 'class':
# if the decorator was attached to a method in a class, or
# otherwise executed at class scope, we need to set an
# 'attr' into the settings if one isn't already in there
# 'attr' in the settings if one isn't already in there
if settings.get('attr') is None:
settings['attr'] = wrapped.__name__

Expand Down

0 comments on commit 2058b2e

Please sign in to comment.