summaryrefslogtreecommitdiff
path: root/docs/narr/views.rst
diff options
context:
space:
mode:
authorMichael Merickel <michael@merickel.org>2013-03-12 13:44:12 -0700
committerMichael Merickel <michael@merickel.org>2013-03-12 13:44:12 -0700
commit22814bb5613546fee0aeec59526ec9c10ae7ac6b (patch)
tree93019973b2267877e38c7e518c1616fb704f7df7 /docs/narr/views.rst
parent40aeaa4d789f068ddaa10768068f2b88d075960f (diff)
parent2dfdecd4c7a8255702aa08f2807b4a3341b270f7 (diff)
downloadpyramid-22814bb5613546fee0aeec59526ec9c10ae7ac6b.tar.gz
pyramid-22814bb5613546fee0aeec59526ec9c10ae7ac6b.tar.bz2
pyramid-22814bb5613546fee0aeec59526ec9c10ae7ac6b.zip
Merge pull request #888 from tshepang/fixes
miscellaneous doc fixes
Diffstat (limited to 'docs/narr/views.rst')
-rw-r--r--docs/narr/views.rst42
1 files changed, 21 insertions, 21 deletions
diff --git a/docs/narr/views.rst b/docs/narr/views.rst
index 8ebdfe219..90f6825c0 100644
--- a/docs/narr/views.rst
+++ b/docs/narr/views.rst
@@ -264,9 +264,9 @@ also be used by application developers to convert arbitrary exceptions to
responses.
To register a view that should be called whenever a particular exception is
-raised from with :app:`Pyramid` view code, use the exception class or one of
-its superclasses as the ``context`` of a view configuration which points at a
-view callable you'd like to generate a response.
+raised from within :app:`Pyramid` view code, use the exception class (or one of
+its superclasses) as the :term:`context` of a view configuration which points
+at a view callable you'd like to generate a response for.
For example, given the following exception class in a module named
``helloworld.exceptions``:
@@ -537,41 +537,41 @@ The following types work as view callables in this style:
e.g.:
.. code-block:: python
- :linenos:
+ :linenos:
- from pyramid.response import Response
+ from pyramid.response import Response
- def view(context, request):
- return Response('OK')
+ def view(context, request):
+ return Response('OK')
#. Classes that have an ``__init__`` method that accepts ``context,
request`` and a ``__call__`` method which accepts no arguments, e.g.:
.. code-block:: python
- :linenos:
+ :linenos:
- from pyramid.response import Response
+ from pyramid.response import Response
- class view(object):
- def __init__(self, context, request):
- self.context = context
- self.request = request
+ class view(object):
+ def __init__(self, context, request):
+ self.context = context
+ self.request = request
- def __call__(self):
- return Response('OK')
+ def __call__(self):
+ return Response('OK')
#. Arbitrary callables that have a ``__call__`` method that accepts
``context, request``, e.g.:
.. code-block:: python
- :linenos:
+ :linenos:
- from pyramid.response import Response
+ from pyramid.response import Response
- class View(object):
- def __call__(self, context, request):
- return Response('OK')
- view = View() # this is the view callable
+ class View(object):
+ def __call__(self, context, request):
+ return Response('OK')
+ view = View() # this is the view callable
This style of calling convention is most useful for :term:`traversal` based
applications, where the context object is frequently used within the view