summaryrefslogtreecommitdiff
path: root/docs/api
diff options
context:
space:
mode:
authorChris McDonough <chrism@agendaless.com>2008-09-16 03:39:36 +0000
committerChris McDonough <chrism@agendaless.com>2008-09-16 03:39:36 +0000
commita232fcf1d23c9943ce11b9191a772bef38cc41a3 (patch)
tree91fd273dcf8ca8f2103e774e9ea2cbf97d792ee0 /docs/api
parentdec15dcd46bb18a2a12bdb5eb5615b3817819155 (diff)
downloadpyramid-a232fcf1d23c9943ce11b9191a772bef38cc41a3.tar.gz
pyramid-a232fcf1d23c9943ce11b9191a772bef38cc41a3.tar.bz2
pyramid-a232fcf1d23c9943ce11b9191a772bef38cc41a3.zip
Document url dispatch in narrative form.
Diffstat (limited to 'docs/api')
-rw-r--r--docs/api/urldispatch.rst48
1 files changed, 0 insertions, 48 deletions
diff --git a/docs/api/urldispatch.rst b/docs/api/urldispatch.rst
index 40b22e5bc..2ebdd6de4 100644
--- a/docs/api/urldispatch.rst
+++ b/docs/api/urldispatch.rst
@@ -8,51 +8,3 @@
.. autoclass:: RoutesMapper
:members:
-An example of configuring a ``bfg:view`` stanza in ``configure.zcml``
-that maps a context found via :term:`Routes` URL dispatch to a view
-function is as follows:
-
-.. code-block:: xml
- :linenos:
-
- <bfg:view
- for="repoze.bfg.interfaces.IRoutesContext"
- view=".views.articles_view"
- name="articles"
- />
-
-All context objects found via Routes URL dispatch will provide the
-``IRoutesContext`` interface (attached dynamically). You might then
-configure the ``RoutesMapper`` like so:
-
-.. code-block:: python
- :linenos:
-
- def fallback_get_root(environ):
- return {} # the graph traversal root is empty in this example
-
- class Article(object):
- def __init__(self, **kw):
- self.__dict__update(kw)
-
- get_root = RoutesMapper(fallback_get_root)
- get_root.connect('archives/:article', controller='articles',
- context_factory=Article)
-
- import myapp
- from repoze.bfg.router import make_app
-
- app = make_app(get_root, myapp)
-
-The effect of this configuration: when this :mod:`repoze.bfg`
-application runs, if any URL matches the pattern
-``archives/:article``, the ``.views.articles_view`` view will be
-called with its :term:`context` as a instance of the ``Article``
-class. The ``Article`` instance will have attributes matching the
-keys and values in the Routes routing dictionary associated with the
-request.
-
-In this case in particular, when a user visits
-``/archives/something``, the context will be an instance of the
-Article class and it will have an ``article`` attribute with the value
-of ``something``.