summaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
authorChris McDonough <chrism@agendaless.com>2008-12-21 21:58:46 +0000
committerChris McDonough <chrism@agendaless.com>2008-12-21 21:58:46 +0000
commitdbc65eac7d026e1c020140818bb9d573d0d56a9c (patch)
tree443d46bbc9a4335bcfed76819a4434fa4c47691c /docs
parentae23c7ee3b398c91128dcac0a88aeb8e0c982964 (diff)
downloadpyramid-dbc65eac7d026e1c020140818bb9d573d0d56a9c.tar.gz
pyramid-dbc65eac7d026e1c020140818bb9d573d0d56a9c.tar.bz2
pyramid-dbc65eac7d026e1c020140818bb9d573d0d56a9c.zip
Fix.
Diffstat (limited to 'docs')
-rw-r--r--docs/narr/views.rst26
1 files changed, 14 insertions, 12 deletions
diff --git a/docs/narr/views.rst b/docs/narr/views.rst
index 3ea6b0b48..fa3622c4f 100644
--- a/docs/narr/views.rst
+++ b/docs/narr/views.rst
@@ -377,9 +377,10 @@ Serving Static Resources Using a View
Using a view is the preferred way to serve static resources (like
JavaScript and CSS files) within :mod:`repoze.bfg`. To create a view
that is capable of serving static resources from a directory that is
-mounted as ``/static``, first create a view in a file in your
-application named "static.py" (this name is arbitrary, it just needs
-to match the following ZCML):
+mounted at the URL path ``/static``, first create a ``static_view``
+view function in a file in your application named ``static.py`` (this
+name is arbitrary, it just needs to match the ZCML registration for
+the view):
.. code-block:: python
:linenos:
@@ -394,8 +395,9 @@ to match the following ZCML):
def static_view(environ, start_response):
return static(environ, start_response)
-Put your static files in ``path/to/static/dir``, then wire it up to be
-accessible as "/static" using ZCML in your application's
+Put your static files (JS, etc) on your filesystem in the directory
+represented as ``/path/to/static/dir``, then wire it up to be
+accessible as ``/static`` using ZCML in your application's
``configure.zcml`` against either the class or interface that
represents your root object.
@@ -412,21 +414,21 @@ In this case, ``.models.Root`` refers to the class of which your BFG
application's root object is an instance.
.. note:: You can also give a ``for`` of ``*`` if you want the name
- ``static`` to be accessible as the static view against any model
- (this will also allow ``/static/foo.js`` to work, but it will allow
+ ``static`` to be accessible as the static view against any model.
+ This will also allow ``/static/foo.js`` to work, but it will allow
for ``/anything/static/foo.js`` too, as long as ``anything`` itself
- is resolved).
+ is resolved.
After this is done, you should be able to view your static files via
URLs prefixed with ``/static/``, for instance ``/static/foo.js``.
To ensure that model objects contained in the root don't "shadow" your
-static view (model objects take precedence during traversal), yor to
+static view (model objects take precedence during traversal), or to
ensure that your root object's ``__getitem__`` is never called when a
static resource is requested, you can refer to your static resources
-as registered above via ``/@@static/foo.js``. This is completely
-equivalent to ``/static/foo.js``. See :ref:`traversal_chapter` for
-information about "goggles" (``@@``).
+as registered above in URLs as, e.g. ``/@@static/foo.js``. This is
+completely equivalent to ``/static/foo.js``. See
+:ref:`traversal_chapter` for information about "goggles" (``@@``).