summaryrefslogtreecommitdiff
path: root/docs/narr/urldispatch.rst
diff options
context:
space:
mode:
authorChris McDonough <chrism@plope.com>2011-08-14 04:58:34 -0400
committerChris McDonough <chrism@plope.com>2011-08-14 04:58:34 -0400
commitfb90f0166728af40142ed9a31039d26ca3f97c73 (patch)
tree16129d464b3533bfd782f53196dd0052f10c1f57 /docs/narr/urldispatch.rst
parentb8a946f9278ead62c38732e7237278adb65303be (diff)
downloadpyramid-fb90f0166728af40142ed9a31039d26ca3f97c73.tar.gz
pyramid-fb90f0166728af40142ed9a31039d26ca3f97c73.tar.bz2
pyramid-fb90f0166728af40142ed9a31039d26ca3f97c73.zip
- The ``route_url``, ``route_path``, ``resource_url``, ``static_url``, and
``current_route_url`` functions in the ``pyramid.url`` package now delegate to a method on the request they've been passed, instead of the other way around. The pyramid.request.Request object now inherits from a mixin named pyramid.url.URLMethodsMixin to make this possible, and all url/path generation logic is embedded in this mixin. - Narrative and API documentation which used the ``route_url``, ``route_path``, ``resource_url``, ``static_url``, and ``current_route_url`` functions in the ``pyramid.url`` package have now been changed to use eponymous methods of the request instead.
Diffstat (limited to 'docs/narr/urldispatch.rst')
-rw-r--r--docs/narr/urldispatch.rst15
1 files changed, 7 insertions, 8 deletions
diff --git a/docs/narr/urldispatch.rst b/docs/narr/urldispatch.rst
index c0197743b..00d36cc76 100644
--- a/docs/narr/urldispatch.rst
+++ b/docs/narr/urldispatch.rst
@@ -765,20 +765,19 @@ Or provide the literal string ``/`` as the pattern:
Generating Route URLs
---------------------
-Use the :func:`pyramid.url.route_url` function to generate URLs based on
-route patterns. For example, if you've configured a route with the ``name``
-"foo" and the ``pattern`` "{a}/{b}/{c}", you might do this.
+Use the :meth:`pyramid.request.Request.route_url` method to generate URLs
+based on route patterns. For example, if you've configured a route with the
+``name`` "foo" and the ``pattern`` "{a}/{b}/{c}", you might do this.
.. ignore-next-block
.. code-block:: python
:linenos:
- from pyramid.url import route_url
- url = route_url('foo', request, a='1', b='2', c='3')
+ url = request.route_url('foo', a='1', b='2', c='3')
This would return something like the string ``http://example.com/1/2/3`` (at
least if the current protocol and hostname implied ``http://example.com``).
-See the :func:`~pyramid.url.route_url` API documentation for more
+See the :meth:`~pyramid.request.Request.route_url` API documentation for more
information.
.. index::
@@ -1122,8 +1121,8 @@ In the above configuration, the ``show_users`` route will have an effective
route pattern of ``/users/show``, instead of ``/show`` because the
``route_prefix`` argument will be prepended to the pattern. The route will
then only match if the URL path is ``/users/show``, and when the
-:func:`pyramid.url.route_url` function is called with the route name
-``show_users``, it will generate a URL with that same path.
+:meth:`pyramid.request.Request.route_url` function is called with the route
+name ``show_users``, it will generate a URL with that same path.
Route prefixes are recursive, so if a callable executed via an include itself
turns around and includes another callable, the second-level route prefix