diff options
| author | Chris McDonough <chrism@agendaless.com> | 2010-09-08 04:25:35 +0000 |
|---|---|---|
| committer | Chris McDonough <chrism@agendaless.com> | 2010-09-08 04:25:35 +0000 |
| commit | 74409d12f7eb085bc992a200cc74799e4d1ff355 (patch) | |
| tree | 14b10948171be45b425f87122be156a7dc11c117 /docs/tutorials | |
| parent | 68469214646debcdcea662f34b41f41e0ae8db12 (diff) | |
| download | pyramid-74409d12f7eb085bc992a200cc74799e4d1ff355.tar.gz pyramid-74409d12f7eb085bc992a200cc74799e4d1ff355.tar.bz2 pyramid-74409d12f7eb085bc992a200cc74799e4d1ff355.zip | |
- The ``repoze.bfg.urldispatch.Route`` constructor (not an API) now
accepts a different ordering of arguments. Previously it was
``(pattern, name, factory=None, predicates=())``. It is now
``(name, pattern, factory=None, predicates=())``. This is in
support of consistency with ``configurator.add_route``.
- The ``repoze.bfg.urldispatch.RoutesMapper.connect`` method (not an
API) now accepts a different ordering of arguments. Previously it
was ``(pattern, name, factory=None, predicates=())``. It is now
``(name, pattern, factory=None, predicates=())``. This is in
support of consistency with ``configurator.add_route``.
- The ``repoze.bfg.urldispatch.RoutesMapper`` object now has a
``get_route`` method which returns a single Route object or
``None``.
- A new interface ``repoze.bfg.interfaces.IRoute`` was added. The
``repoze.bfg.urldispatch.Route`` object implements this interface.
- The canonical attribute for accessing the routing pattern from a
route object is now ``pattern`` rather than ``path``.
- The argument to ``repoze.bfg.configuration.Configurator.add_route``
which was previously called ``path`` is now called ``pattern`` for
better explicability. For backwards compatibility purposes, passing
a keyword argument named ``path`` to ``add_route`` will still work
indefinitely.
- The ``path`` attribute to the ZCML ``route`` directive is now named
``pattern`` for better explicability. The older ``path`` attribute
will continue to work indefinitely.
- All narrative, API, and tutorial docs which referred to a route
pattern as a ``path`` have now been updated to refer to them as a
``pattern``.
- The routesalchemy template has been updated to use ``pattern`` in
its route declarations rather than ``path``.
Diffstat (limited to 'docs/tutorials')
6 files changed, 30 insertions, 27 deletions
diff --git a/docs/tutorials/bfgwiki2/basiclayout.rst b/docs/tutorials/bfgwiki2/basiclayout.rst index a284b2eb4..e09316fab 100644 --- a/docs/tutorials/bfgwiki2/basiclayout.rst +++ b/docs/tutorials/bfgwiki2/basiclayout.rst @@ -35,7 +35,7 @@ following: #. *Lines 6-11*. Register a ``<route>`` :term:`route configuration` that will be used when the URL is ``/``. Since this ``<route>`` - has an empty ``path`` attribute, it is the "default" route. The + has an empty ``pattern`` attribute, it is the "default" route. The attribute named ``view`` with the value ``.views.my_view`` is the dotted name to a *function* we write (generated by the ``bfg_routesalchemy`` template) that is given a ``request`` object diff --git a/docs/tutorials/bfgwiki2/definingviews.rst b/docs/tutorials/bfgwiki2/definingviews.rst index 775334b51..c33795883 100644 --- a/docs/tutorials/bfgwiki2/definingviews.rst +++ b/docs/tutorials/bfgwiki2/definingviews.rst @@ -22,12 +22,13 @@ callable is assumed to return a :term:`response` object. The request passed to every view that is called as the result of a route match has an attribute named ``matchdict`` that contains the -elements placed into the URL by the ``path`` of a ``route`` statement. -For instance, if a route statement in ``configure.zcml`` had the path -``:one/:two``, and the URL at ``http://example.com/foo/bar`` was -invoked, matching this path, the matchdict dictionary attached to the -request passed to the view would have a ``one`` key with the value -``foo`` and a ``two`` key with the value ``bar``. +elements placed into the URL by the ``pattern`` of a ``route`` +statement. For instance, if a route statement in ``configure.zcml`` +had the pattern ``:one/:two``, and the URL at +``http://example.com/foo/bar`` was invoked, matching this pattern, the +matchdict dictionary attached to the request passed to the view would +have a ``one`` key with the value ``foo`` and a ``two`` key with the +value ``bar``. The source code for this tutorial stage can be browsed at `docs.repoze.org <http://docs.repoze.org/bfgwiki2-1.3/views>`_. @@ -275,21 +276,21 @@ Note that the *ordering* of these declarations is very important. ``route`` declarations are matched in the order they're found in the ``configure.zcml`` file. -#. Add a declaration which maps the empty path (signifying the root +#. Add a declaration which maps the empty pattern (signifying the root URL) to the view named ``view_wiki`` in our ``views.py`` file with the name ``view_wiki``. This is the :term:`default view` for the wiki. -#. Add a declaration which maps the path pattern ``:pagename`` to the +#. Add a declaration which maps the pattern ``:pagename`` to the view named ``view_page`` in our ``views.py`` file with the view name ``view_page``. This is the regular view for a page. -#. Add a declaration which maps the path pattern +#. Add a declaration which maps the pattern ``:pagename/edit_page`` to the view named ``edit_page`` in our ``views.py`` file with the name ``edit_page``. This is the edit view for a page. -#. Add a declaration which maps the path pattern +#. Add a declaration which maps the pattern ``add_page/:pagename`` to the view named ``add_page`` in our ``views.py`` file with the name ``add_page``. This is the add view for a new page. diff --git a/docs/tutorials/bfgwiki2/src/authorization/tutorial/configure.zcml b/docs/tutorials/bfgwiki2/src/authorization/tutorial/configure.zcml index e51a67d70..213573d7a 100644 --- a/docs/tutorials/bfgwiki2/src/authorization/tutorial/configure.zcml +++ b/docs/tutorials/bfgwiki2/src/authorization/tutorial/configure.zcml @@ -4,38 +4,38 @@ <include package="repoze.bfg.includes" /> <static + pattern="templates/static" name="static" - path="templates/static" /> <route - path="login" + pattern="login" name="login" view=".login.login" view_renderer="templates/login.pt" /> <route - path="logout" + pattern="logout" name="logout" view=".login.logout" /> <route - path="" + pattern="" name="view_wiki" view=".views.view_wiki" /> <route - path=":pagename" + pattern=":pagename" name="view_page" view=".views.view_page" view_renderer="templates/view.pt" /> <route - path="add_page/:pagename" + pattern="add_page/:pagename" name="add_page" view=".views.add_page" view_renderer="templates/edit.pt" @@ -43,7 +43,7 @@ /> <route - path=":pagename/edit_page" + pattern=":pagename/edit_page" name="edit_page" view=".views.edit_page" view_renderer="templates/edit.pt" diff --git a/docs/tutorials/bfgwiki2/src/basiclayout/tutorial/configure.zcml b/docs/tutorials/bfgwiki2/src/basiclayout/tutorial/configure.zcml index 143f58a45..f04eec9b4 100644 --- a/docs/tutorials/bfgwiki2/src/basiclayout/tutorial/configure.zcml +++ b/docs/tutorials/bfgwiki2/src/basiclayout/tutorial/configure.zcml @@ -3,15 +3,16 @@ <!-- this must be included for the view declarations to work --> <include package="repoze.bfg.includes" /> - <route path="" + <route + pattern="" name="home" view=".views.my_view" view_renderer="templates/mytemplate.pt" /> <static + pattern="templates/static" name="static" - path="templates/static" /> </configure> diff --git a/docs/tutorials/bfgwiki2/src/models/tutorial/configure.zcml b/docs/tutorials/bfgwiki2/src/models/tutorial/configure.zcml index 143f58a45..f04eec9b4 100644 --- a/docs/tutorials/bfgwiki2/src/models/tutorial/configure.zcml +++ b/docs/tutorials/bfgwiki2/src/models/tutorial/configure.zcml @@ -3,15 +3,16 @@ <!-- this must be included for the view declarations to work --> <include package="repoze.bfg.includes" /> - <route path="" + <route + pattern="" name="home" view=".views.my_view" view_renderer="templates/mytemplate.pt" /> <static + pattern="templates/static" name="static" - path="templates/static" /> </configure> diff --git a/docs/tutorials/bfgwiki2/src/views/tutorial/configure.zcml b/docs/tutorials/bfgwiki2/src/views/tutorial/configure.zcml index 7a8576a56..f86468186 100644 --- a/docs/tutorials/bfgwiki2/src/views/tutorial/configure.zcml +++ b/docs/tutorials/bfgwiki2/src/views/tutorial/configure.zcml @@ -4,32 +4,32 @@ <include package="repoze.bfg.includes" /> <static + pattern="templates/static" name="static" - path="templates/static" /> <route - path="" + pattern="" name="view_wiki" view=".views.view_wiki" /> <route - path=":pagename" + pattern=":pagename" name="view_page" view=".views.view_page" view_renderer="templates/view.pt" /> <route - path="add_page/:pagename" + pattern="add_page/:pagename" name="add_page" view=".views.add_page" view_renderer="templates/edit.pt" /> <route - path=":pagename/edit_page" + pattern=":pagename/edit_page" name="edit_page" view=".views.edit_page" view_renderer="templates/edit.pt" |
