summaryrefslogtreecommitdiff
path: root/docs/narr
diff options
context:
space:
mode:
authorChris McDonough <chrism@agendaless.com>2009-12-25 06:44:37 +0000
committerChris McDonough <chrism@agendaless.com>2009-12-25 06:44:37 +0000
commit0ac7b075f76b3989fe9eb763b73bab827c9deccd (patch)
tree50c8d7d38837cb468af45ee90e34efec21bf3e73 /docs/narr
parenta0169ff21b5cd7446bf0289bffdb52de8dc61290 (diff)
downloadpyramid-0ac7b075f76b3989fe9eb763b73bab827c9deccd.tar.gz
pyramid-0ac7b075f76b3989fe9eb763b73bab827c9deccd.tar.bz2
pyramid-0ac7b075f76b3989fe9eb763b73bab827c9deccd.zip
Fix syntax errors found via manuel, and add manuel-style markers to prevent
untestable code blocks from being tested.
Diffstat (limited to 'docs/narr')
-rw-r--r--docs/narr/configuration.rst6
-rw-r--r--docs/narr/events.rst1
-rw-r--r--docs/narr/hooks.rst2
-rw-r--r--docs/narr/models.rst10
-rw-r--r--docs/narr/resources.rst5
-rw-r--r--docs/narr/scanning.rst1
-rw-r--r--docs/narr/security.rst4
-rw-r--r--docs/narr/templates.rst1
-rw-r--r--docs/narr/urldispatch.rst3
-rw-r--r--docs/narr/views.rst9
-rw-r--r--docs/narr/webob.rst1
11 files changed, 35 insertions, 8 deletions
diff --git a/docs/narr/configuration.rst b/docs/narr/configuration.rst
index e56d9f1d1..3183d278a 100644
--- a/docs/narr/configuration.rst
+++ b/docs/narr/configuration.rst
@@ -326,6 +326,7 @@ this particular :mod:`repoze.bfg` application.
Beginning Configuration
~~~~~~~~~~~~~~~~~~~~~~~
+.. ignore-next-block
.. code-block:: python
:linenos:
@@ -344,6 +345,7 @@ associated with the configurator to become "current".
Adding Configuration
~~~~~~~~~~~~~~~~~~~~
+.. ignore-next-block
.. code-block:: python
:linenos:
@@ -445,6 +447,7 @@ ends with ``/goodbye``.
Ending Configuration
~~~~~~~~~~~~~~~~~~~~
+.. ignore-next-block
.. code-block:: python
:linenos:
@@ -462,6 +465,7 @@ associated with the configurator.
WSGI Application Creation
~~~~~~~~~~~~~~~~~~~~~~~~~
+.. ignore-next-block
.. code-block:: python
:linenos:
@@ -493,6 +497,7 @@ when it visits the URL with the path info ``/goodbye``.
WSGI Application Serving
~~~~~~~~~~~~~~~~~~~~~~~~
+.. ignore-next-block
.. code-block:: python
:linenos:
@@ -750,6 +755,7 @@ just spelling things differently, using XML instead of Python.
In our previously defined application, in which we added view
configurations imperatively, we saw this code:
+.. ignore-next-block
.. code-block:: python
:linenos:
diff --git a/docs/narr/events.rst b/docs/narr/events.rst
index 6dac04add..c257ddb86 100644
--- a/docs/narr/events.rst
+++ b/docs/narr/events.rst
@@ -115,6 +115,7 @@ file:
Or imperatively via the
:meth:`repoze.bfg.configuration.Configurator.add_subscriber` method:
+.. ignore-next-block
.. code-block:: python
:linenos:
diff --git a/docs/narr/hooks.rst b/docs/narr/hooks.rst
index 862019209..f8ad29832 100644
--- a/docs/narr/hooks.rst
+++ b/docs/narr/hooks.rst
@@ -348,6 +348,8 @@ The API that must be implemented by a class that provides
.. code-block:: python
:linenos:
+ from zope.interface import Interface
+
class IContextURL(Interface):
""" An adapter which deals with URLs related to a context.
"""
diff --git a/docs/narr/models.rst b/docs/narr/models.rst
index 5002101d5..fdd8af9bc 100644
--- a/docs/narr/models.rst
+++ b/docs/narr/models.rst
@@ -97,8 +97,8 @@ interface (as opposed to its class). To do so, use the
self.author = author
self.created = datetime.datetime.now()
- entry = BlogEntry()
- directlyProvides(IBlogEntry, entry)
+ entry = BlogEntry('title', 'body', 'author')
+ directlyProvides(entry, IBlogEntry)
If a model object already has instance-level interface declarations
that you don't want to disturb, use the
@@ -124,9 +124,9 @@ that you don't want to disturb, use the
self.author = author
self.created = datetime.datetime.now()
- entry = BlogEntry()
- directlyProvides(IBlogEntry1, entry)
- alsoProvides(IBlogEntry2, entry)
+ entry = BlogEntry('title', 'body', 'author')
+ directlyProvides(entry, IBlogEntry1)
+ alsoProvides(entry, IBlogEntry2)
See the :ref:`views_chapter` for more information about why providing
models with an interface can be an interesting thing to do with regard
diff --git a/docs/narr/resources.rst b/docs/narr/resources.rst
index ea16c814a..91e4aee92 100644
--- a/docs/narr/resources.rst
+++ b/docs/narr/resources.rst
@@ -40,6 +40,7 @@ example, the application might address the resource named
``templates/some_template.pt`` using that API within a ``views.py``
file inside a ``myapp`` package:
+.. ignore-next-block
.. code-block:: python
:linenos:
@@ -150,6 +151,7 @@ An individual call to
:meth:`repoze.bfg.configuration.Configurator.override_resource` can
override a single resource. For example:
+.. ignore-next-block
.. code-block:: python
:linenos:
@@ -165,6 +167,7 @@ optional. If they are not specified, the override attempts to resolve
every lookup into a package from the directory of another package.
For example:
+.. ignore-next-block
.. code-block:: python
:linenos:
@@ -173,6 +176,7 @@ For example:
Individual subdirectories within a package can also be overridden:
+.. ignore-next-block
.. code-block:: python
:linenos:
@@ -203,6 +207,7 @@ construction file resides (or the ``package`` argument to the
:class:`repoze.bfg.configuration.Configurator` class construction).
For example:
+.. ignore-next-block
.. code-block:: python
:linenos:
diff --git a/docs/narr/scanning.rst b/docs/narr/scanning.rst
index 1276c058d..a7f47efd4 100644
--- a/docs/narr/scanning.rst
+++ b/docs/narr/scanning.rst
@@ -74,6 +74,7 @@ this is best represented as the scanner translating the arguments to
:meth:`repoze.bfg.configuration.Configurator.add_view` method,
effectively:
+.. ignore-next-block
.. code-block:: python
:linenos:
diff --git a/docs/narr/security.rst b/docs/narr/security.rst
index f88456730..5cebd9792 100644
--- a/docs/narr/security.rst
+++ b/docs/narr/security.rst
@@ -31,11 +31,12 @@ application setup to specify an authentication policy.
For example:
+.. ignore-next-block
.. code-block:: python
:linenos:
from repoze.bfg.configuration import Configurator
- from repoze.bfg.authentication import AuthTktAutenticationPolicy
+ from repoze.bfg.authentication import AuthTktAuthenticationPolicy
from repoze.bfg.authorization import ACLAuthorizationPolicy
authentication_policy = AuthTktAuthenticationPolicy('seekrit')
authorization_policy = ACLAuthorizationPolicy()
@@ -124,6 +125,7 @@ The equivalent view registration including the 'add' permission name
may be performed via the ``bfg_view`` decorator within the "views"
module of your project's package
+.. ignore-next-block
.. code-block:: python
:linenos:
diff --git a/docs/narr/templates.rst b/docs/narr/templates.rst
index c8778ffdf..1ea8da369 100644
--- a/docs/narr/templates.rst
+++ b/docs/narr/templates.rst
@@ -349,6 +349,7 @@ then return that string as the body of a :term:`WebOb`
<http://www.makotemplates.org/>`_ installed, here's an example of
using Mako from within a :mod:`repoze.bfg` :term:`view`:
+.. ignore-next-block
.. code-block:: python
:linenos:
diff --git a/docs/narr/urldispatch.rst b/docs/narr/urldispatch.rst
index 4299faba7..ac604e347 100644
--- a/docs/narr/urldispatch.rst
+++ b/docs/narr/urldispatch.rst
@@ -62,6 +62,7 @@ The :meth:`repoze.bfg.configuration.Configurator.add_route` method
adds a single :term:`route configuration` to the :term:`application
registry`. Here's an example:
+.. ignore-next-block
.. code-block:: python
:linenos:
@@ -638,6 +639,7 @@ based on route paths. For example, if you've configured a route in
ZCML with the ``name`` "foo" and the ``path`` ":a/:b/:c", you might do
this.
+.. ignore-next-block
.. code-block:: python
from repoze.bfg.url import route_url
@@ -730,6 +732,7 @@ SQLAlchemy, and you'd like the current SQLAlchemy database session to
be removed after each request. Put the following in the
``mypackage.run`` module:
+.. ignore-next-block
.. code-block:: python
from mypackage.sql import DBSession
diff --git a/docs/narr/views.rst b/docs/narr/views.rst
index 13b73b28e..a073bb6d8 100644
--- a/docs/narr/views.rst
+++ b/docs/narr/views.rst
@@ -651,6 +651,7 @@ purpose.
An example might reside in a bfg application module ``views.py``:
+.. ignore-next-block
.. code-block:: python
:linenos:
@@ -659,9 +660,9 @@ An example might reside in a bfg application module ``views.py``:
from repoze.bfg.chameleon_zpt import render_template_to_response
@bfg_view(name='my_view', request_method='POST', for_=MyModel,
- permission='read')
+ permission='read', renderer='templates/my.pt')
def my_view(request):
- return render_template_to_response('templates/my.pt')
+ return {'a':1}
Using this decorator as above replaces the need to add this ZCML to
your application registry:
@@ -675,10 +676,12 @@ your application registry:
name="my_view"
permission="read"
request_method="POST"
+ renderer="templates/my.pt"
/>
Or replaces the need to add this imperative configuration stanza:
+.. ignore-next-block
.. code-block:: python
:linenos:
@@ -759,6 +762,7 @@ All arguments may be omitted. For example:
:linenos:
from webob import Response
+ from repoze.bfg.view import bfg_view
@bfg_view()
def my_view(request):
@@ -1614,6 +1618,7 @@ filesystem at ``/path/to/static/dir`` mounted at the URL path
:mod:`repoze.bfg.view` 's ``static`` class inside a ``static.py`` file
in your application root as below.
+.. ignore-next-block
.. code-block:: python
:linenos:
diff --git a/docs/narr/webob.rst b/docs/narr/webob.rst
index 2886190f5..8dbdef6f2 100644
--- a/docs/narr/webob.rst
+++ b/docs/narr/webob.rst
@@ -263,6 +263,7 @@ the error. For instance, ``webob.exc.HTTPNotFound``. It subclasses
``Response``, so you can manipulate the instances in the same way. A
typical example is:
+.. ignore-next-block
.. code-block:: python
from webob.exc import HTTPNotFound