From 56d0fe4a9f97daa4d5fd0c28ea83c6ef32856b3d Mon Sep 17 00:00:00 2001 From: Chris McDonough Date: Thu, 14 Jul 2011 01:13:27 -0400 Subject: - New API class: ``pyramid.static.static_view``. This supersedes the deprecated ``pyramid.view.static`` class. ``pyramid.satic.static_view`` by default serves up documents as the result of the request's ``path_info``, attribute rather than it's ``subpath`` attribute (the inverse was true of ``pyramid.view.static``, and still is). ``pyramid.static.static_view`` exposes a ``use_subpath`` flag for use when you don't want the static view to behave like the older deprecated version. - The ``pyramid.view.static`` class has been deprecated in favor of the newer ``pyramid.static.static_view`` class. A deprecation warning is raised when it is used. You should replace it with a reference to ``pyramid.static.static_view`` with the ``use_subpath=True`` argument. --- docs/narr/hybrid.rst | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) (limited to 'docs/narr/hybrid.rst') diff --git a/docs/narr/hybrid.rst b/docs/narr/hybrid.rst index 97adaeafd..a0a6a108c 100644 --- a/docs/narr/hybrid.rst +++ b/docs/narr/hybrid.rst @@ -431,8 +431,9 @@ Using ``*subpath`` in a Route Pattern There are certain extremely rare cases when you'd like to influence the traversal :term:`subpath` when a route matches without actually performing traversal. For instance, the :func:`pyramid.wsgi.wsgiapp2` decorator and the -:class:`pyramid.view.static` helper attempt to compute ``PATH_INFO`` from the -request's subpath, so it's useful to be able to influence this value. +:class:`pyramid.static.static_view` helper attempt to compute ``PATH_INFO`` +from the request's subpath when its ``use_subpath`` argument is ``True``, so +it's useful to be able to influence this value. When ``*subpath`` exists in a pattern, no path is actually traversed, but the traversal algorithm will return a :term:`subpath` list implied @@ -442,12 +443,16 @@ commonly in route declarations that look like this: .. code-block:: python :linenos: + from pryamid.static import static_view + + www = static_view('mypackage:static', use_subpath=True) + config.add_route('static', '/static/*subpath') - config.add_view('mypackage.views.static_view', route_name='static') + config.add_view(www, route_name='static') -Where ``mypackage.views.static_view`` is an instance of -:class:`pyramid.view.static`. This effectively tells the static helper to -traverse everything in the subpath as a filename. +``mypackage.views.www`` is an instance of +:class:`pyramid.static.static_view`. This effectively tells the static +helper to traverse everything in the subpath as a filename. Corner Cases ------------ -- cgit v1.2.3 From 6ce1e0cf1a141767ee0aca70786c15dd993347c5 Mon Sep 17 00:00:00 2001 From: Chris McDonough Date: Wed, 20 Jul 2011 06:10:38 -0400 Subject: add more index markers --- docs/narr/hybrid.rst | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'docs/narr/hybrid.rst') diff --git a/docs/narr/hybrid.rst b/docs/narr/hybrid.rst index a0a6a108c..ab1bf20bb 100644 --- a/docs/narr/hybrid.rst +++ b/docs/narr/hybrid.rst @@ -79,6 +79,9 @@ Typically, an application that uses traversal exclusively won't perform any calls to :meth:`pyramid.config.Configurator.add_route` in its startup code. +.. index:: + single: hybrid applications + Hybrid Applications ------------------- @@ -177,6 +180,9 @@ match is straightforward. When a route is matched: root factory were explained previously within :ref:`the_resource_tree`. +.. index:: + pair: hybrid applications; *traverse route pattern + .. _using_traverse_in_a_route_pattern: Using ``*traverse`` In a Route Pattern @@ -400,6 +406,9 @@ Traversal will begin at the root object implied by this route (either the global root, or the object returned by the ``factory`` associated with this route). +.. index:: + pair: hybrid applications; global views + Making Global Views Match +++++++++++++++++++++++++ @@ -420,6 +429,7 @@ attribute. config.add_view('myproject.views.bazbuz', name='bazbuz') .. index:: + pair: hybrid applications; *subpath single: route subpath single: subpath (route) @@ -454,6 +464,9 @@ commonly in route declarations that look like this: :class:`pyramid.static.static_view`. This effectively tells the static helper to traverse everything in the subpath as a filename. +.. index:: + pair: hybrid applications; corner cases + Corner Cases ------------ -- cgit v1.2.3