summaryrefslogtreecommitdiff
path: root/docs/narr/hooks.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/hooks.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/hooks.rst')
-rw-r--r--docs/narr/hooks.rst19
1 files changed, 10 insertions, 9 deletions
diff --git a/docs/narr/hooks.rst b/docs/narr/hooks.rst
index 50758f327..df5339c8a 100644
--- a/docs/narr/hooks.rst
+++ b/docs/narr/hooks.rst
@@ -468,17 +468,18 @@ when the application :term:`root factory` returned an instance of the
.. _changing_resource_url:
-Changing How :mod:`pyramid.url.resource_url` Generates a URL
-------------------------------------------------------------
+Changing How :meth:`pyramid.request.Request.resource_url` Generates a URL
+-------------------------------------------------------------------------
When you add a traverser as described in :ref:`changing_the_traverser`, it's
-often convenient to continue to use the :func:`pyramid.url.resource_url` API.
-However, since the way traversal is done will have been modified, the URLs it
-generates by default may be incorrect.
+often convenient to continue to use the
+:meth:`pyramid.request.Request.resource_url` API. However, since the way
+traversal is done will have been modified, the URLs it generates by default
+may be incorrect.
If you've added a traverser, you can change how
-:func:`~pyramid.url.resource_url` generates a URL for a specific type of
-resource by adding a registerAdapter call for
+:meth:`~pyramid.request.Request.resource_url` generates a URL for a specific
+type of resource by adding a registerAdapter call for
:class:`pyramid.interfaces.IContextURL` to your application:
.. code-block:: python
@@ -493,8 +494,8 @@ resource by adding a registerAdapter call for
IContextURL)
In the above example, the ``myapp.traversal.URLGenerator`` class will be used
-to provide services to :func:`~pyramid.url.resource_url` any time the
-:term:`context` passed to ``resource_url`` is of class
+to provide services to :meth:`~pyramid.request.Request.resource_url` any time
+the :term:`context` passed to ``resource_url`` is of class
``myapp.resources.MyRoot``. The second argument in the ``(MyRoot,
Interface)`` tuple represents the type of interface that must be possessed by
the :term:`request` (in this case, any interface, represented by