From e4e3aa3449d3ae390402a9cead205626816a2938 Mon Sep 17 00:00:00 2001 From: Chris McDonough Date: Sun, 27 Dec 2009 15:32:14 +0000 Subject: Rendering cleanups. --- docs/narr/views.rst | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) (limited to 'docs/narr/views.rst') diff --git a/docs/narr/views.rst b/docs/narr/views.rst index 5f9eb9140..c9929538f 100644 --- a/docs/narr/views.rst +++ b/docs/narr/views.rst @@ -125,7 +125,10 @@ request The following types work as views in this style: #. Functions that accept two arguments: ``context``, and ``request``, - e.g.:: + e.g.: + + .. code-block:: python + :linenos: from webob import Response @@ -133,7 +136,10 @@ The following types work as views in this style: return Response('OK') #. New-style and old-style classes that have an ``__init__`` method - that accepts ``context, request``, e.g.:: + that accepts ``context, request``, e.g.: + + .. code-block:: python + :linenos: from webob import Response @@ -142,7 +148,10 @@ The following types work as views in this style: return Response('OK') #. Arbitrary callables that have a ``__call__`` method that accepts - ``context, request``, e.g.:: + ``context, request``, e.g.: + + .. code-block:: python + :linenos: from webob import Response @@ -358,7 +367,6 @@ the following: your application's ``configure.zcml``: .. code-block:: xml - :linenos: @@ -366,7 +374,6 @@ the following: :meth:`repoze.bfg.configuration.Configurator.scan` method: .. code-block:: python - :linenos: config.scan() @@ -436,7 +443,6 @@ Or replaces the need to add this imperative configuration stanza: .. ignore-next-block .. code-block:: python - :linenos: config.add_view(name='my_view', request_method='POST', for_=MyModel, permission='read') @@ -1461,6 +1467,7 @@ a browser client, and its ``action`` points at some :mod:`repoze.bfg` view code: .. code-block:: xml + :linenos: @@ -1483,6 +1490,7 @@ expect that the values returned by ``request.params`` will be of type accept a form post from the above form: .. code-block:: python + :linenos: def myview(request): firstname = request.params['firstname'] @@ -1493,6 +1501,7 @@ decode already-decoded (``unicode``) values obtained from ``request.params``: .. code-block:: python + :linenos: def myview(request): # the .decode('utf-8') will break below if there are any high-order -- cgit v1.2.3