diff options
| author | Chris McDonough <chrism@agendaless.com> | 2009-07-03 01:41:04 +0000 |
|---|---|---|
| committer | Chris McDonough <chrism@agendaless.com> | 2009-07-03 01:41:04 +0000 |
| commit | 7bc20e11b5ed7314e5aaed000242d4d5950fc775 (patch) | |
| tree | 6cb253ea95617ca4f24aa365f145ec2f81bf53fc /docs/narr/urldispatch.rst | |
| parent | c43c358c7ec7d352fd4792b993e4609cbab37dba (diff) | |
| download | pyramid-7bc20e11b5ed7314e5aaed000242d4d5950fc775.tar.gz pyramid-7bc20e11b5ed7314e5aaed000242d4d5950fc775.tar.bz2 pyramid-7bc20e11b5ed7314e5aaed000242d4d5950fc775.zip | |
General editing walkthrough.
Diffstat (limited to 'docs/narr/urldispatch.rst')
| -rw-r--r-- | docs/narr/urldispatch.rst | 25 |
1 files changed, 21 insertions, 4 deletions
diff --git a/docs/narr/urldispatch.rst b/docs/narr/urldispatch.rst index ccfbdff58..90ddd6672 100644 --- a/docs/narr/urldispatch.rst +++ b/docs/narr/urldispatch.rst @@ -195,8 +195,14 @@ Will generate the following matchdict:: {'traverse':(u'La Pe\xf1a', u'a', u'b', u'c')} +``<route>`` Statement Examples +------------------------------ + +Let's check out some examples of how ``<route>`` statements might be +commonly declared. + Example 1 ---------- +~~~~~~~~~ The simplest route delcaration: @@ -231,7 +237,7 @@ specified in the ``route`` declaration. It is a mapping object, a lot like a dictionary. Example 2 ---------- +~~~~~~~~~ Below is an example of some more complicated route statements you might add to your ``configure.zcml``: @@ -273,7 +279,7 @@ view available at the dotted Python pathname ``mypackage.views.idea_view``. Example 3 ---------- +~~~~~~~~~ The context object passed to a view found as the result of URL dispatch will by default be an instance of the object returned by the @@ -322,7 +328,7 @@ during ``make_app`. If the "fallback" root factory is None, a not used then. Example 4 ---------- +~~~~~~~~~ An example of configuring a ``view`` declaration in ``configure.zcml`` that maps a context found via URL dispatch to a view function is as @@ -392,6 +398,17 @@ declaration: view=".views.root_view" /> +Or provide the literal string ``/`` as the path: + +.. code-block:: xml + :linenos: + + <route + path="/" + name="root" + view=".views.root_view" + /> + Generating Route URLs --------------------- |
