diff options
| author | Chris McDonough <chrism@plope.com> | 2012-02-15 19:09:08 -0500 |
|---|---|---|
| committer | Chris McDonough <chrism@plope.com> | 2012-02-15 19:09:08 -0500 |
| commit | 748aad47f90136b151be13f477ed6af1caed0493 (patch) | |
| tree | a111a7e9f58d022b4f9c047648ee8dfabed00dcb /docs | |
| parent | c0b7076cb5ad4dcf5840c95f527955e3483d7cae (diff) | |
| download | pyramid-748aad47f90136b151be13f477ed6af1caed0493.tar.gz pyramid-748aad47f90136b151be13f477ed6af1caed0493.tar.bz2 pyramid-748aad47f90136b151be13f477ed6af1caed0493.zip | |
- Add ``pyramid.config.Configurator.set_traverser`` API method. See the
Hooks narrative documentation section entitled "Changing the Traverser" for
more information. This is not a new feature, it just provides an API for
adding a traverser without needing to use the ZCA API.
Diffstat (limited to 'docs')
| -rw-r--r-- | docs/api/config.rst | 2 | ||||
| -rw-r--r-- | docs/narr/hooks.rst | 14 | ||||
| -rw-r--r-- | docs/narr/introspector.rst | 15 |
3 files changed, 23 insertions, 8 deletions
diff --git a/docs/api/config.rst b/docs/api/config.rst index d16930cc0..3c5ee563a 100644 --- a/docs/api/config.rst +++ b/docs/api/config.rst @@ -94,6 +94,8 @@ .. automethod:: set_notfound_view + .. automethod:: set_traverser + .. automethod:: set_renderer_globals_factory(factory) .. attribute:: introspectable diff --git a/docs/narr/hooks.rst b/docs/narr/hooks.rst index 350b5734d..076f9fa5c 100644 --- a/docs/narr/hooks.rst +++ b/docs/narr/hooks.rst @@ -406,11 +406,10 @@ via configuration. .. code-block:: python :linenos: - from pyramid.interfaces import ITraverser - from zope.interface import Interface + from pyramid.config import Configurator from myapp.traversal import Traverser - - config.registry.registerAdapter(Traverser, (Interface,), ITraverser) + config = Configurator() + config.set_traverser(Traverser) In the example above, ``myapp.traversal.Traverser`` is assumed to be a class that implements the following interface: @@ -456,12 +455,11 @@ used. Otherwise, the default traverser would be used. For example: .. code-block:: python :linenos: - from pyramid.interfaces import ITraverser - from zope.interface import Interface from myapp.traversal import Traverser from myapp.resources import MyRoot - - config.registry.registerAdapter(Traverser, (MyRoot,), ITraverser) + from pyramid.config import Configurator + config = Configurator() + config.set_traverser(Traverser, MyRoot) If the above stanza was added to a Pyramid ``__init__.py`` file's ``main`` function, :app:`Pyramid` would use the ``myapp.traversal.Traverser`` only diff --git a/docs/narr/introspector.rst b/docs/narr/introspector.rst index 11d779854..08cc430f6 100644 --- a/docs/narr/introspector.rst +++ b/docs/narr/introspector.rst @@ -529,6 +529,21 @@ introspectables in categories not described here. A normalized version of the ``spec`` argument provided to ``add_static_view``. +``traversers`` + + Each introspectable in the ``traversers`` category represents a call to + :meth:`pyramid.config.Configurator.add_traverser`; each will have the + following data. + + ``iface`` + + The (resolved) interface or class object that represents the return value + of a root factory that this traverser will be used for. + + ``factory`` + + The (resolved) traverser class. + Introspection in the Toolbar ---------------------------- |
