Permalink
Browse files

update for 1.1

  • Loading branch information...
1 parent 5c85310 commit ac2b9f31d627251c5c150394b521c4e58f13e8d8 @mcdonc mcdonc committed Jul 14, 2011
Showing with 12 additions and 12 deletions.
  1. +12 −12 static.rst
View
@@ -57,7 +57,7 @@ served by a view which hooks up the static file's URL.
Root-Relative Custom Static View (URL Dispatch Only)
----------------------------------------------------
-The :class:`pyramid.view.static` helper class generates a Pyramid view
+The :class:`pyramid.static.static_view` helper class generates a Pyramid view
callable. This view callable can serve static assets from a directory. An
instance of this class is actually used by the
:meth:`pyramid.config.Configurator.add_static_view` configuration method, so
@@ -68,26 +68,26 @@ its behavior is almost exactly the same once it's configured.
exclusively. The root-relative route we'll be registering will always be
matched before traversal takes place, subverting any views registered via
``add_view`` (at least those without a ``route_name``). A
- :class:`pyramid.view.static` static view cannot be made root-relative when
- you use traversal.
+ :class:`pyramid.static.static_view` cannot be made root-relative when you
+ use traversal.
To serve files within a directory located on your filesystem at
``/path/to/static/dir`` as the result of a "catchall" route hanging from the
root that exists at the end of your routing table, create an instance of the
-:class:`pyramid.view.static` class inside a ``static.py`` file in your
+:class:`pyramid.static.static_view` class inside a ``static.py`` file in your
application root as below.
.. ignore-next-block
.. code-block:: python
:linenos:
- from pyramid.view import static
- static_view = static('/path/to/static/dir')
+ from pyramid.static import static_view
+ www = static_view('/path/to/static/dir', use_subpath=True)
.. note:: For better cross-system flexibility, use an :term:`asset
- specification` as the argument to :class:`pyramid.view.static` instead of
- a physical absolute filesystem path, e.g. ``mypackage:static`` instead of
- ``/path/to/mypackage/static``.
+ specification` as the argument to :class:`pyramid.static.static_view`
+ instead of a physical absolute filesystem path, e.g. ``mypackage:static``
+ instead of ``/path/to/mypackage/static``.
Subsequently, you may wire the files that are served by this view up to be
accessible as ``/<filename>`` using a configuration method in your
@@ -99,9 +99,9 @@ application's startup code.
# .. every other add_route and/or add_handler declaration should come
# before this one, as it will, by default, catch all requests
- config.add_route('catchall_static', '/*subpath', 'myapp.static.static_view')
+ config.add_route('catchall_static', '/*subpath', 'myapp.static.www')
The special name ``*subpath`` above is used by the
-:class:`pyramid.view.static` view callable to signify the path of the file
-relative to the directory you're serving.
+:class:`pyramid.static.static_view` view callable to signify the path of the
+file relative to the directory you're serving.

0 comments on commit ac2b9f3

Please sign in to comment.