diff options
| author | Casey Duncan <casey.duncan@gmail.com> | 2011-01-02 21:37:24 -0700 |
|---|---|---|
| committer | Casey Duncan <casey.duncan@gmail.com> | 2011-01-02 21:37:24 -0700 |
| commit | f9bd7aa61148fada7c0b36df96b5c42670d8c85e (patch) | |
| tree | 015d83fca7a21fe70367fc31cda065a0ff0304a3 /docs/narr/views.rst | |
| parent | fa1dec9ec10e4aca0b1bb69c544e6dc64e297fdf (diff) | |
| download | pyramid-f9bd7aa61148fada7c0b36df96b5c42670d8c85e.tar.gz pyramid-f9bd7aa61148fada7c0b36df96b5c42670d8c85e.tar.bz2 pyramid-f9bd7aa61148fada7c0b36df96b5c42670d8c85e.zip | |
rework view callables intro
Diffstat (limited to 'docs/narr/views.rst')
| -rw-r--r-- | docs/narr/views.rst | 36 |
1 files changed, 18 insertions, 18 deletions
diff --git a/docs/narr/views.rst b/docs/narr/views.rst index e1a7c4679..39e40a23a 100644 --- a/docs/narr/views.rst +++ b/docs/narr/views.rst @@ -38,24 +38,24 @@ a detailed explanation of view lookup. View Callables -------------- -No matter how a view callable is eventually found, all view callables -used by :app:`Pyramid` must be constructed in the same way, and -must return the same kind of return value. - -Most view callables accept a single argument named ``request``. This -argument represents a :app:`Pyramid` :term:`Request` object. A request -object encapsulates a WSGI environment as represented to :app:`Pyramid` by -the upstream :term:`WSGI` server. - -In general, a view callable must return a :mod:`Pyramid` :term:`Response` -object. - -.. note:: The above statement, though it sounds definitive, isn't always - true. See :ref:`renderers_chapter` for information related to using a - :term:`renderer` to convert a non-Response view callable return value into - a Response object. - -View callables can be functions, instances, or classes. +View callables are, at the risk of sounding obvious, callable Python +objects. Specifically, view callables can be functions, classes, or +instances that implement an ``__call__`` method (making the +instance callable). + +View callables must, at a minimum, accept a single argument named +``request``. This argument represents a :app:`Pyramid` :term:`Request` +object. A request object encapsulates a WSGI environment provided to +:app:`Pyramid` by the upstream :term:`WSGI` server. As you might expect, +the request object contains everything your application needs to know +about the specific HTTP request being made. + +In general, a view callable must return a :mod:`Pyramid` +:term:`Response` object. If a view callable does not return a response +itself, it will typically be configured with a :term:`renderer` that +converts its response value into a :term:`Response` object. Using +renderers is the common way that templates are bound to view callables. +See the :ref:`renderers_chapter` chapter for details. .. index:: single: view calling convention |
