diff options
| -rw-r--r-- | docs/narr/muchadoabouttraversal.rst | 2 | ||||
| -rw-r--r-- | docs/narr/renderers.rst | 14 | ||||
| -rw-r--r-- | docs/narr/traversal.rst | 2 | ||||
| -rw-r--r-- | docs/narr/urldispatch.rst | 4 | ||||
| -rw-r--r-- | docs/narr/viewconfig.rst | 2 | ||||
| -rw-r--r-- | docs/narr/views.rst | 23 |
6 files changed, 23 insertions, 24 deletions
diff --git a/docs/narr/muchadoabouttraversal.rst b/docs/narr/muchadoabouttraversal.rst index c57e58cd0..467a9e601 100644 --- a/docs/narr/muchadoabouttraversal.rst +++ b/docs/narr/muchadoabouttraversal.rst @@ -108,7 +108,7 @@ Traversal (aka Resource Location) single: traversal overview Believe it or not, if you understand how serving files from a file system -works,you understand traversal. And if you understand that a server might do +works, you understand traversal. And if you understand that a server might do something different based on what type of file a given request specifies, then you understand view lookup. diff --git a/docs/narr/renderers.rst b/docs/narr/renderers.rst index a80c5a9c2..91c00057b 100644 --- a/docs/narr/renderers.rst +++ b/docs/narr/renderers.rst @@ -79,7 +79,7 @@ If the :term:`view callable` associated with a :term:`view configuration` returns a Response object directly (an object with the attributes ``status``, ``headerlist`` and ``app_iter``), any renderer associated with the view configuration is ignored, and the response is passed back to :app:`Pyramid` -unmolested. For example, if your view callable returns an instance of the +unchanged. For example, if your view callable returns an instance of the :class:`pyramid.httpexceptions.HTTPFound` class as a response, no renderer will be employed. @@ -351,7 +351,7 @@ to influence associated response attributes. e.g. ``text/xml``. ``response_headerlist`` - A sequence of tuples describing cookie values that should be set in the + A sequence of tuples describing header values that should be set in the response, e.g. ``[('Set-Cookie', 'abc=123'), ('X-My-Header', 'foo')]``. ``response_status`` @@ -464,7 +464,7 @@ There are essentially two different kinds of renderer factories: .. sidebar:: Asset Specifications - A asset specification is a colon-delimited identifier for a + A asset specification is a colon-delimited identifier for an :term:`asset`. The colon separates a Python :term:`package` name from a package subpath. For example, the asset specification ``my.package:static/baz.css`` identifies the file named @@ -500,8 +500,8 @@ At startup time, when a :term:`view configuration` is encountered, which has a ``name`` attribute that does not contain a dot, the full ``name`` value is used to construct a renderer from the associated renderer factory. In this case, the view configuration will create an instance -of an ``AMFRenderer`` for each view configuration which includes ``amf`` -as its renderer value. The ``name`` passed to the ``AMFRenderer`` +of an ``MyAMFRenderer`` for each view configuration which includes ``amf`` +as its renderer value. The ``name`` passed to the ``MyAMFRenderer`` constructor will always be ``amf``. Here's an example of the registration of a more complicated renderer @@ -534,9 +534,9 @@ typically the filename extension. This extension is used to look up a renderer factory for the configured view. Then the value of ``renderer`` is passed to the factory to create a renderer for the view. In this case, the view configuration will create an instance of a -``Jinja2Renderer`` for each view configuration which includes anything +``MyJinja2Renderer`` for each view configuration which includes anything ending with ``.jinja2`` in its ``renderer`` value. The ``name`` passed -to the ``Jinja2Renderer`` constructor will be the full value that was +to the ``MyJinja2Renderer`` constructor will be the full value that was set as ``renderer=`` in the view configuration. See also :ref:`renderer_directive` and diff --git a/docs/narr/traversal.rst b/docs/narr/traversal.rst index 7c6280ba1..a858644ca 100644 --- a/docs/narr/traversal.rst +++ b/docs/narr/traversal.rst @@ -355,7 +355,7 @@ Here's what happens: - :mod:`traversal` traverses "foo", and attempts to find "bar", which it finds. -- :mod:`traversal` traverses bar, and attempts to find "baz", which it does +- :mod:`traversal` traverses "bar", and attempts to find "baz", which it does not find (the "bar" resource raises a :exc:`KeyError` when asked for "baz"). diff --git a/docs/narr/urldispatch.rst b/docs/narr/urldispatch.rst index 2a00697b4..44396e024 100644 --- a/docs/narr/urldispatch.rst +++ b/docs/narr/urldispatch.rst @@ -416,7 +416,7 @@ In this way, each route can use a different factory, making it possible to supply a different :term:`context` resource object to the view related to each particular route. -Supplying a different resource factory each route is useful when you're +Supplying a different resource factory for each route is useful when you're trying to use a :app:`Pyramid` :term:`authorization policy` to provide declarative, "context sensitive" security checks; each resource can maintain a separate :term:`ACL`, as documented in @@ -1034,7 +1034,7 @@ route patterns. For example, if you've configured a route with the ``name`` url = route_url('foo', request, a='1', b='2', c='3') This would return something like the string ``http://example.com/1/2/3`` (at -least if the current protocol and hostname implied ``http:/example.com``). +least if the current protocol and hostname implied ``http://example.com``). See the :func:`pyramid.url.route_url` API documentation for more information. .. index:: diff --git a/docs/narr/viewconfig.rst b/docs/narr/viewconfig.rst index 3f2b1b179..092bd6012 100644 --- a/docs/narr/viewconfig.rst +++ b/docs/narr/viewconfig.rst @@ -157,7 +157,7 @@ Non-Predicate Arguments The ``renderer`` attribute is optional. If it is not defined, the "null" renderer is assumed (no rendering is performed and the value is passed back - to the upstream :app:`Pyramid` machinery unmolested). Note that if the + to the upstream :app:`Pyramid` machinery unchanged). Note that if the view callable itself returns a :term:`response` (see :ref:`the_response`), the specified renderer implementation is never called. diff --git a/docs/narr/views.rst b/docs/narr/views.rst index 16d9d964d..392e5ea4a 100644 --- a/docs/narr/views.rst +++ b/docs/narr/views.rst @@ -94,7 +94,7 @@ Defining a View Callable as a Class A view callable may also be represented by a Python class instead of a function. When a view callable is a class, the calling semantics are slightly different than when it is a function or another non-class callable. -When a view callable is a class, the class' ``__init__`` is called with a +When a view callable is a class, the class' ``__init__`` method is called with a ``request`` parameter. As a result, an instance of the class is created. Subsequently, that instance's ``__call__`` method is invoked with no parameters. Views defined as classes must have the following traits: @@ -122,13 +122,12 @@ The request object passed to ``__init__`` is the same type of request object described in :ref:`function_as_view`. If you'd like to use a different attribute than ``__call__`` to represent the -method expected to return a response, you can either: - -- use an ``attr`` value as part of the configuration for the view. See - :ref:`view_configuration_parameters`. The same view callable class can be - used in different view configuration statements with different ``attr`` - values, each pointing at a different method of the class if you'd like the - class to represent a collection of related view callables. +method expected to return a response, you can use an ``attr`` value as part +of the configuration for the view. See :ref:`view_configuration_parameters`. +The same view callable class can be used in different view configuration +statements with different ``attr`` values, each pointing at a different +method of the class if you'd like the class to represent a collection of +related view callables. .. note:: A package named :term:`pyramid_handlers` (available from PyPI) provides an analogue of :term:`Pylons` -style "controllers", which are a @@ -174,7 +173,7 @@ The following types work as view callables in this style: return Response('OK') #. Classes that have an ``__init__`` method that accepts ``context, - request`` and a ``__call__`` which accepts no arguments, e.g.: + request`` and a ``__call__`` method which accepts no arguments, e.g.: .. code-block:: python :linenos: @@ -218,7 +217,7 @@ access to the context via ``request.context``. View Callable Responses ----------------------- -A view callable may always return an object that implements the :app:`Pyramid` +A view callable may return an object that implements the :app:`Pyramid` :term:`Response` interface. The easiest way to return something that implements the :term:`Response` interface is to return a :class:`pyramid.response.Response` object instance directly. For example: @@ -253,7 +252,7 @@ app_iter world!</body></html>']`` or it can be a file-like object, or any other sort of iterable. -These attributes form the notional "Pyramid Response interface". +These attributes form the structure of the "Pyramid Response interface". .. index:: single: view http redirect @@ -370,7 +369,7 @@ raises a ``hellworld.exceptions.ValidationFailure`` exception: Assuming that a :term:`scan` was run to pick up this view registration, this view callable will be invoked whenever a -``helloworld.exceptions.ValidationError`` is raised by your application's +``helloworld.exceptions.ValidationFailure`` is raised by your application's view code. The same exception raised by a custom root factory or a custom traverser is also caught and hooked. |
