summaryrefslogtreecommitdiff
path: root/docs/narr
diff options
context:
space:
mode:
authorBlaise Laflamme <blaise@laflamme.org>2010-11-28 12:28:30 -0500
committerBlaise Laflamme <blaise@laflamme.org>2010-11-28 12:29:25 -0500
commit16cd50c1a5beef98c3297d105c1ccffccb8872c5 (patch)
treea42f0b082048c13916d48ca23719ec8d78074642 /docs/narr
parent099ac84208c019300174c0c8722cff7687bb43ca (diff)
downloadpyramid-16cd50c1a5beef98c3297d105c1ccffccb8872c5.tar.gz
pyramid-16cd50c1a5beef98c3297d105c1ccffccb8872c5.tar.bz2
pyramid-16cd50c1a5beef98c3297d105c1ccffccb8872c5.zip
Normalized narrative doc, code with linenos while text+bash don't
Diffstat (limited to 'docs/narr')
-rw-r--r--docs/narr/configuration.rst1
-rw-r--r--docs/narr/declarative.rst1
-rw-r--r--docs/narr/environment.rst1
-rw-r--r--docs/narr/firstapp.rst2
-rw-r--r--docs/narr/handlers.rst8
-rw-r--r--docs/narr/i18n.rst4
-rw-r--r--docs/narr/install.rst4
-rw-r--r--docs/narr/models.rst1
-rw-r--r--docs/narr/project.rst5
-rw-r--r--docs/narr/security.rst6
-rw-r--r--docs/narr/static.rst1
-rw-r--r--docs/narr/templates.rst9
-rw-r--r--docs/narr/urldispatch.rst1
-rw-r--r--docs/narr/views.rst2
-rw-r--r--docs/narr/webob.rst2
15 files changed, 34 insertions, 14 deletions
diff --git a/docs/narr/configuration.rst b/docs/narr/configuration.rst
index ae02a5a6c..ea3a6c866 100644
--- a/docs/narr/configuration.rst
+++ b/docs/narr/configuration.rst
@@ -142,6 +142,7 @@ method, effectively:
.. ignore-next-block
.. code-block:: python
+ :linenos:
config.add_view(hello)
diff --git a/docs/narr/declarative.rst b/docs/narr/declarative.rst
index 3c5eb9db4..eeaed318f 100644
--- a/docs/narr/declarative.rst
+++ b/docs/narr/declarative.rst
@@ -256,7 +256,6 @@ application we created earlier in :ref:`helloworld_imperative`. We can run
it the same way.
.. code-block:: text
- :linenos:
$ python helloworld.py
serving on 0.0.0.0:8080 view at http://127.0.0.1:8080
diff --git a/docs/narr/environment.rst b/docs/narr/environment.rst
index 814cb70d6..af03077af 100644
--- a/docs/narr/environment.rst
+++ b/docs/narr/environment.rst
@@ -290,7 +290,6 @@ for settings documented as such. For example, you might start your
:app:`Pyramid` application using the following command line:
.. code-block:: text
- :linenos:
$ BFG_DEBUG_AUTHORIZATION=1 BFG_RELOAD_TEMPLATES=1 bin/paster serve \
MyProject.ini
diff --git a/docs/narr/firstapp.rst b/docs/narr/firstapp.rst
index 17140fe07..c49e788b0 100644
--- a/docs/narr/firstapp.rst
+++ b/docs/narr/firstapp.rst
@@ -263,6 +263,7 @@ WSGI Application Creation
.. ignore-next-block
.. code-block:: python
+ :linenos:
app = config.make_wsgi_app()
@@ -294,6 +295,7 @@ WSGI Application Serving
.. ignore-next-block
.. code-block:: python
+ :linenos:
serve(app, host='0.0.0.0')
diff --git a/docs/narr/handlers.rst b/docs/narr/handlers.rst
index d82f42bdb..0dce6afe4 100644
--- a/docs/narr/handlers.rst
+++ b/docs/narr/handlers.rst
@@ -37,6 +37,7 @@ will call that view callable.
Here's an example view handler class:
.. code-block:: python
+ :linenos:
from pyramid.response import Response
@@ -58,6 +59,7 @@ An accompanying call to the
be performed in order to register it with the system:
.. code-block:: python
+ :linenos:
config.add_handler('hello', '/hello/{action}', handler=Hello)
@@ -74,6 +76,7 @@ Alternatively, the action can be declared specifically for a URL to go to a
specific ``action`` name:
.. code-block:: python
+ :linenos:
config.add_handler('hello_index', '/hello/index',
handler=Hello, action='index')
@@ -97,6 +100,7 @@ directly through to :meth:`pyramid.configuration.Configurator.add_route`.
For example:
.. code-block:: python
+ :linenos:
config.add_handler('hello', '/hello/{action}',
handler='mypackage.handlers:MyHandler')
@@ -110,6 +114,7 @@ specify the same handler, to register specific route names for different
handler/action combinations. For example:
.. code-block:: python
+ :linenos:
config.add_handler('hello_index', '/hello/index',
handler=Hello, action='index')
@@ -139,6 +144,7 @@ Every method in the handler class that has a name meeting the
disabled by setting the ``__autoexpose__`` attribute to ``None``:
.. code-block:: python
+ :linenos:
from pyramid.view import action
@@ -179,6 +185,7 @@ name that is different from the method name by passing in a ``name`` argument.
Example:
.. code-block:: python
+ :linenos:
from pyramid.view import action
@@ -205,6 +212,7 @@ URL's can result in different template renderings with the same data.
Example:
.. code-block:: python
+ :linenos:
from pyramid.view import action
diff --git a/docs/narr/i18n.rst b/docs/narr/i18n.rst
index f6f3cdc42..603b08cef 100644
--- a/docs/narr/i18n.rst
+++ b/docs/narr/i18n.rst
@@ -339,7 +339,6 @@ which reside in your :app:`Pyramid` application. You run a
``setup.py`` command to extract the messages:
.. code-block:: text
- :linenos:
$ cd /place/where/myapplication/setup.py/lives
$ mkdir -p myapplication/locale
@@ -429,7 +428,6 @@ locale from a pre-generated ``.pot`` template by using the ``setup.py
init_catalog`` command:
.. code-block:: text
- :linenos:
$ cd /place/where/myapplication/setup.py/lives
$ python setup.py init_catalog -l es
@@ -461,7 +459,6 @@ First, regenerate the ``.pot`` file as per :ref:`extracting_messages`.
Then use the ``setup.py update_catalog`` command.
.. code-block:: text
- :linenos:
$ cd /place/where/myapplication/setup.py/lives
$ python setup.py update_catalog
@@ -478,7 +475,6 @@ Finally, to prepare an application for performing actual runtime
translations, compile ``.po`` files to ``.mo`` files:
.. code-block:: text
- :linenos:
$ cd /place/where/myapplication/setup.py/lives
$ python setup.py compile_catalog
diff --git a/docs/narr/install.rst b/docs/narr/install.rst
index c753b7298..db1cfaf9d 100644
--- a/docs/narr/install.rst
+++ b/docs/narr/install.rst
@@ -334,7 +334,7 @@ The ``pyramid_jinja2`` distribution provides templating for
:app:`Pyramid` using the :term:`Jinja2` templating system. You may
install it like so using the ``easy_install`` command for Jython:
-.. code-block:: python
+.. code-block:: text
$ easy_install pyramid_jinja2
@@ -342,7 +342,7 @@ Once this is done, you can use this command to get started with a
:app:`Pyramid` sample application that uses the Jinja2 templating
engine:
-.. code-block:: python
+.. code-block:: text
$ paster create -t pyramid_jinja2_starter
diff --git a/docs/narr/models.rst b/docs/narr/models.rst
index f8488cc80..20f443571 100644
--- a/docs/narr/models.rst
+++ b/docs/narr/models.rst
@@ -272,6 +272,7 @@ The ``__parent__`` of the root object should be ``None`` and its
``__name__`` should be the empty string. For instance:
.. code-block:: python
+ :linenos:
class MyRootObject(object):
__name__ = ''
diff --git a/docs/narr/project.rst b/docs/narr/project.rst
index 1758e9d00..b2b0931b6 100644
--- a/docs/narr/project.rst
+++ b/docs/narr/project.rst
@@ -257,7 +257,7 @@ points to *your application* as opposed to any other section within the
``.ini`` file. For example, if your application ``.ini`` file might have a
``[app:MyProject]`` section that looks like so:
-.. code-block:: guess
+.. code-block:: ini
:linenos:
[app:MyProject]
@@ -930,6 +930,7 @@ Then change the __init__.py of your myproject project (*not* the
parent directory). For example, from something like:
.. code-block:: python
+ :linenos:
config.add_view('myproject.views.my_view',
renderer='myproject:templates/mytemplate.pt')
@@ -937,6 +938,7 @@ parent directory). For example, from something like:
To this:
.. code-block:: python
+ :linenos:
config.add_view('myproject.views.blogs.my_view',
renderer='myproject:templates/mytemplate.pt')
@@ -946,6 +948,7 @@ views or handler classes/functions within those files via the dotted name
passed as the first argument to ``add_view``. For example:
.. code-block:: python
+ :linenos:
config.add_view('myproject.views.anothermodule.my_view',
renderer='myproject:templates/anothertemplate.pt')
diff --git a/docs/narr/security.rst b/docs/narr/security.rst
index 782dbffb1..2c696772a 100644
--- a/docs/narr/security.rst
+++ b/docs/narr/security.rst
@@ -436,6 +436,7 @@ authorization policy is in effect might look like so:
the following:
.. code-block:: python
+ :linenos:
from pyramid.security import ALL_PERMISSIONS
__acl__ = [ (Deny, Everyone, ALL_PERMISSIONS) ]
@@ -512,7 +513,8 @@ This behavior can also be turned on in the application ``.ini`` file
by setting the ``debug_authorization`` key to ``true`` within the
application's configuration section, e.g.:
-.. code-block:: guess
+.. code-block:: ini
+ :linenos:
[app:main]
use = egg:MyProject#app
@@ -555,6 +557,7 @@ authenticate. Doing so is a matter of creating an instance of something
that implements the following interface:
.. code-block:: python
+ :linenos:
class AuthenticationPolicy(object):
""" An object representing a Pyramid authentication policy. """
@@ -610,6 +613,7 @@ matter of creating an instance of an object that implements the
following interface:
.. code-block:: python
+ :linenos:
class IAuthorizationPolicy(object):
""" An object representing a Pyramid authorization policy. """
diff --git a/docs/narr/static.rst b/docs/narr/static.rst
index a01cbbabf..beb12c586 100644
--- a/docs/narr/static.rst
+++ b/docs/narr/static.rst
@@ -185,6 +185,7 @@ resources which begin with ``mypackage:images`` will be prefixed with
``http://example.com/images``:
.. code-block:: python
+ :linenos:
static_url('mypackage:images/logo.png', request)
# -> http://example.com/images/logo.png
diff --git a/docs/narr/templates.rst b/docs/narr/templates.rst
index e11f69ab1..c1c2fe31e 100644
--- a/docs/narr/templates.rst
+++ b/docs/narr/templates.rst
@@ -593,7 +593,6 @@ author's ``svn propedit svn:ignore .`` in each of my ``templates``
directories.
.. code-block:: text
- :linenos:
*.pt.py
*.txt.py
@@ -632,7 +631,8 @@ To use a setting in the application ``.ini`` file for the same
purpose, set the ``debug_templates`` key to ``true`` within the
application's configuration section, e.g.:
-.. code-block:: guess
+.. code-block:: ini
+ :linenos:
[app:main]
use = egg:MyProject#app
@@ -642,7 +642,7 @@ With template debugging off, a :exc:`NameError` exception resulting
from rendering a template with an undefined variable
(e.g. ``${wrong}``) might end like this:
-.. code-block:: python
+.. code-block:: text
File "...", in __getitem__
raise NameError(key)
@@ -794,7 +794,8 @@ To use a setting in the application ``.ini`` file for the same
purpose, set the ``reload_templates`` key to ``true`` within the
application's configuration section, e.g.:
-.. code-block:: guess
+.. code-block:: ini
+ :linenos:
[app:main]
use = egg:MyProject#app
diff --git a/docs/narr/urldispatch.rst b/docs/narr/urldispatch.rst
index 0fc7d22af..b025ce8d6 100644
--- a/docs/narr/urldispatch.rst
+++ b/docs/narr/urldispatch.rst
@@ -1143,6 +1143,7 @@ custom notfound view as the first argument to its constructor. For
instance:
.. code-block:: python
+ :linenos:
from pyramid.exceptions import NotFound
from pyramid.view import AppendSlashNotFoundViewFactory
diff --git a/docs/narr/views.rst b/docs/narr/views.rst
index 9a42bb177..04d90fda8 100644
--- a/docs/narr/views.rst
+++ b/docs/narr/views.rst
@@ -1459,6 +1459,7 @@ configuration stanza:
.. ignore-next-block
.. code-block:: python
+ :linenos:
config.add_view('.views.my_view', name='my_view', request_method='POST',
context=MyModel, permission='read')
@@ -1488,6 +1489,7 @@ view configuration. To make :app:`Pyramid` process your
``scan`` method of a :class:`pyramid.configuration.Configurator`:
.. code-block:: python
+ :linenos:
# config is assumed to be an instance of the
# pyramid.configuration.Configurator class
diff --git a/docs/narr/webob.rst b/docs/narr/webob.rst
index 17827fac9..92de9d409 100644
--- a/docs/narr/webob.rst
+++ b/docs/narr/webob.rst
@@ -288,6 +288,7 @@ Generally any attribute of the response can be passed in as a keyword
argument to the class; e.g.:
.. code-block:: python
+ :linenos:
from pyramid.response import Response
response = Response(body='hello world!', content_type='text/plain')
@@ -316,6 +317,7 @@ the same way. A typical example is:
.. ignore-next-block
.. code-block:: python
+ :linenos:
from pyramid.httpexceptions import HTTPNotFound
from pyramid.httpexceptions import HTTPMovedPermanently