summaryrefslogtreecommitdiff
path: root/docs/narr/assets.rst
diff options
context:
space:
mode:
authorChris McDonough <chrism@plope.com>2011-01-27 23:06:55 -0500
committerChris McDonough <chrism@plope.com>2011-01-27 23:06:55 -0500
commit70acd25f40f32fc6cbb3b5d38a695b8982b52a31 (patch)
treeecaee199a36054a3664c39a7955cb441aaf6503d /docs/narr/assets.rst
parent45c45f3ba6b688c988957056cb2c49883329dfe5 (diff)
downloadpyramid-70acd25f40f32fc6cbb3b5d38a695b8982b52a31.tar.gz
pyramid-70acd25f40f32fc6cbb3b5d38a695b8982b52a31.tar.bz2
pyramid-70acd25f40f32fc6cbb3b5d38a695b8982b52a31.zip
module name contractions
Diffstat (limited to 'docs/narr/assets.rst')
-rw-r--r--docs/narr/assets.rst56
1 files changed, 28 insertions, 28 deletions
diff --git a/docs/narr/assets.rst b/docs/narr/assets.rst
index ee2e0440e..a9dc1f129 100644
--- a/docs/narr/assets.rst
+++ b/docs/narr/assets.rst
@@ -142,7 +142,7 @@ see :ref:`advanced_static`.
Here's another example that uses an :term:`asset specification` instead of an
absolute path as the ``path`` argument. To convince
-:meth:`pyramid.config.Configurator.add_static_view` to serve files up under
+:meth:`~pyramid.config.Configurator.add_static_view` to serve files up under
the ``/static`` URL from the ``a/b/c/static`` directory of the Python package
named ``some_package``, we can use a fully qualified :term:`asset
specification` as the ``path``:
@@ -153,17 +153,17 @@ specification` as the ``path``:
# config is an instance of pyramid.config.Configurator
config.add_static_view(name='static', path='some_package:a/b/c/static')
-The ``path`` provided to :meth:`pyramid.config.Configurator.add_static_view`
+The ``path`` provided to :meth:`~pyramid.config.Configurator.add_static_view`
may be a fully qualified :term:`asset specification` or an *absolute path*.
Instead of representing a URL prefix, the ``name`` argument of a call to
-:meth:`pyramid.config.Configurator.add_static_view` can alternately be a
+:meth:`~pyramid.config.Configurator.add_static_view` can alternately be a
*URL*. Each of examples we've seen so far have shown usage of the ``name``
argument as a URL prefix. However, when ``name`` is a *URL*, static assets
can be served from an external webserver. In this mode, the ``name`` is used
as the URL prefix when generating a URL using :func:`pyramid.url.static_url`.
-For example, :meth:`pyramid.config.Configurator.add_static_view` may
+For example, :meth:`~pyramid.config.Configurator.add_static_view` may
be fed a ``name`` argument which is ``http://example.com/images``:
.. code-block:: python
@@ -173,20 +173,20 @@ be fed a ``name`` argument which is ``http://example.com/images``:
config.add_static_view(name='http://example.com/images',
path='mypackage:images')
-Because :meth:`pyramid.config.Configurator.add_static_view` is provided with
+Because :meth:`~pyramid.config.Configurator.add_static_view` is provided with
a ``name`` argument that is the URL ``http://example.com/images``, subsequent
-calls to :func:`pyramid.url.static_url` with paths that start with the
+calls to :func:`~pyramid.url.static_url` with paths that start with the
``path`` argument passed to
-:meth:`pyramid.config.Configurator.add_static_view` will generate a URL
+:meth:`~pyramid.config.Configurator.add_static_view` will generate a URL
something like ``http://example.com/images/logo.png``. The external
webserver listening on ``example.com`` must be itself configured to respond
-properly to such a request. The :func:`pyramid.url.static_url` API is
+properly to such a request. The :func:`~pyramid.url.static_url` API is
discussed in more detail later in this chapter.
.. note::
The :ref:`static_directive` ZCML directive offers an declarative
- equivalent to :meth:`pyramid.config.Configurator.add_static_view`. Use of
+ equivalent to :meth:`~pyramid.config.Configurator.add_static_view`. Use of
the :ref:`static_directive` ZCML directive is completely equivalent to
using imperative configuration for the same purpose.
@@ -199,7 +199,7 @@ discussed in more detail later in this chapter.
Generating Static Asset URLs
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-When a :meth:`pyramid.config.Configurator.add_static_view` method is used to
+When a :meth:`~pyramid.config.Configurator.add_static_view` method is used to
register a static asset directory, a special helper API named
:func:`pyramid.url.static_url` can be used to generate the appropriate URL
for an asset that lives in one of the directories named by the static
@@ -221,7 +221,7 @@ visits a URL which begins with ``/static1``, and the assets in the
visits a URL which begins with ``/static2``.
You needn't generate the URLs to static assets "by hand" in such a
-configuration. Instead, use the :func:`pyramid.url.static_url` API to
+configuration. Instead, use the :func:`~pyramid.url.static_url` API to
generate them for you. For example:
.. code-block:: python
@@ -242,15 +242,15 @@ If the request "application URL" of the running system is
``http://example.com/static1/foo.css``. The ``js_url`` generated
above would be ``http://example.com/static2/foo.js``.
-One benefit of using the :func:`pyramid.url.static_url` function rather than
+One benefit of using the :func:`~pyramid.url.static_url` function rather than
constructing static URLs "by hand" is that if you need to change the ``name``
of a static URL declaration, the generated URLs will continue to resolve
properly after the rename.
-URLs may also be generated by :func:`pyramid.url.static_url` to static assets
+URLs may also be generated by :func:`~pyramid.url.static_url` to static assets
that live *outside* the :app:`Pyramid` application. This will happen when
-the :meth:`pyramid.config.Configurator.add_static_view` API associated with
-the path fed to :func:`pyramid.url.static_url` is a *URL* instead of a view
+the :meth:`~pyramid.config.Configurator.add_static_view` API associated with
+the path fed to :func:`~pyramid.url.static_url` is a *URL* instead of a view
name. For example, the ``name`` argument may be ``http://example.com`` while
the the ``path`` given may be ``mypackage:images``:
@@ -270,13 +270,13 @@ assets which begin with ``mypackage:images`` will be prefixed with
static_url('mypackage:images/logo.png', request)
# -> http://example.com/images/logo.png
-Using :func:`pyramid.url.static_url` in conjunction with a
-:meth:`pyramid.configuration.Configurator.add_static_view` makes it possible
+Using :func:`~pyramid.url.static_url` in conjunction with a
+:meth:`~pyramid.configuration.Configurator.add_static_view` makes it possible
to put static media on a separate webserver during production (if the
-``name`` argument to :meth:`pyramid.config.Configurator.add_static_view` is a
+``name`` argument to :meth:`~pyramid.config.Configurator.add_static_view` is a
URL), while keeping static media package-internal and served by the
development webserver during development (if the ``name`` argument to
-:meth:`pyramid.config.Configurator.add_static_view` is a URL prefix). To
+:meth:`~pyramid.config.Configurator.add_static_view` is a URL prefix). To
create such a circumstance, we suggest using the
:attr:`pyramid.registry.Registry.settings` API in conjunction with a setting
in the application ``.ini`` file named ``media_location``. Then set the
@@ -300,7 +300,7 @@ dispatch`, you may want static assets to only be available as a fallback if
no previous route matches. Alternately, you might like to serve a particular
static asset manually, because its download requires authentication.
-Note that you cannot use the :func:`pyramid.url.static_url` API to generate
+Note that you cannot use the :func:`~pyramid.url.static_url` API to generate
URLs against assets made accessible by registering a custom static view.
Root-Relative Custom Static View (URL Dispatch Only)
@@ -309,7 +309,7 @@ Root-Relative Custom Static View (URL Dispatch Only)
The :class:`pyramid.view.static` 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
+:meth:`~pyramid.config.Configurator.add_static_view` configuration method, so
its behavior is almost exactly the same once it's configured.
.. warning:: The following example *will not work* for applications that use
@@ -317,13 +317,13 @@ 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
+ :class:`~pyramid.view.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.view.static` class inside a ``static.py`` file in your
application root as below.
.. ignore-next-block
@@ -334,7 +334,7 @@ application root as below.
static_view = static('/path/to/static/dir')
.. note:: For better cross-system flexibility, use an :term:`asset
- specification` as the argument to :class:`pyramid.view.static` instead of
+ 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``.
@@ -351,7 +351,7 @@ application's startup code.
config.add_route('catchall_static', '/*subpath', 'myapp.static.static_view')
The special name ``*subpath`` above is used by the
-:class:`pyramid.view.static` view callable to signify the path of the file
+:class:`~pyramid.view.static` view callable to signify the path of the file
relative to the directory you're serving.
Registering A View Callable to Serve a "Static" Asset
@@ -440,7 +440,7 @@ feature, a :term:`Configurator` API exists named
setuptools :term:`pkg_resources` API.
.. note:: The :term:`ZCML` directive named ``asset`` serves the same purpose
- as the :meth:`pyramid.config.Configurator.override_asset` method.
+ as the :meth:`~pyramid.config.Configurator.override_asset` method.
.. index::
single: override_asset
@@ -450,7 +450,7 @@ feature, a :term:`Configurator` API exists named
The ``override_asset`` API
~~~~~~~~~~~~~~~~~~~~~~~~~~
-An individual call to :meth:`pyramid.config.Configurator.override_asset`
+An individual call to :meth:`~pyramid.config.Configurator.override_asset`
can override a single asset. For example:
.. ignore-next-block
@@ -503,7 +503,7 @@ if you want to override assets for both ``some.package:templates``, and
The package name in a specification may start with a dot, meaning that
the package is relative to the package in which the configuration
construction file resides (or the ``package`` argument to the
-:class:`pyramid.config.Configurator` class construction).
+:class:`~pyramid.config.Configurator` class construction).
For example:
.. ignore-next-block