summaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
Diffstat (limited to 'docs')
-rw-r--r--docs/narr/hooks.rst24
-rw-r--r--docs/narr/viewconfig.rst8
-rw-r--r--docs/quick_tour.rst14
3 files changed, 28 insertions, 18 deletions
diff --git a/docs/narr/hooks.rst b/docs/narr/hooks.rst
index b22b31bf9..d21edc7b4 100644
--- a/docs/narr/hooks.rst
+++ b/docs/narr/hooks.rst
@@ -116,14 +116,6 @@ callable:
.. note::
- Both :meth:`pyramid.config.Configurator.add_notfound_view` and
- :class:`pyramid.view.notfound_view_config` are new as of Pyramid 1.3.
- Older Pyramid documentation instructed users to use ``add_view`` instead,
- with a ``context`` of ``HTTPNotFound``. This still works; the convenience
- method and decorator are just wrappers around this functionality.
-
-.. warning::
-
When a Not Found View callable accepts an argument list as described in
:ref:`request_and_context_view_definitions`, the ``context`` passed as the
first argument to the view callable will be the
@@ -131,6 +123,13 @@ callable:
available, the resource context will still be available as
``request.context``.
+.. warning::
+
+ The :term:`Not Found View` callables are only invoked when a
+ :exc:`~pyramid.httpexceptions.HTTPNotFound` exception is raised. If the
+ exception is returned from a view then it will be treated as a regular
+ response object and it will not trigger the custom view.
+
.. index::
single: forbidden view
@@ -210,6 +209,13 @@ Here's some sample code that implements a minimal forbidden view:
whether the ``pyramid.debug_authorization`` environment setting is true or
false.
+.. warning::
+
+ The :term:`forbidden view` callables are only invoked when a
+ :exc:`~pyramid.httpexceptions.HTTPForbidden` exception is raised. If the
+ exception is returned from a view then it will be treated as a regular
+ response object and it will not trigger the custom view.
+
.. index::
single: request factory
@@ -744,7 +750,9 @@ The API that must be implemented by a class that provides
""" Accept the resource and request and set self.physical_path and
self.virtual_path """
self.virtual_path = some_function_of(resource, request)
+ self.virtual_path_tuple = some_function_of(resource, request)
self.physical_path = some_other_function_of(resource, request)
+ self.physical_path_tuple = some_function_of(resource, request)
The default context URL generator is available for perusal as the class
:class:`pyramid.traversal.ResourceURL` in the `traversal module
diff --git a/docs/narr/viewconfig.rst b/docs/narr/viewconfig.rst
index 7cb8e0306..3b683ff79 100644
--- a/docs/narr/viewconfig.rst
+++ b/docs/narr/viewconfig.rst
@@ -252,7 +252,7 @@ Non-Predicate Arguments
def myview(request):
...
- Is similar to doing::
+ Is similar to decorating the view callable directly::
@view_config(...)
@decorator2
@@ -260,8 +260,10 @@ Non-Predicate Arguments
def myview(request):
...
- All view callables in the decorator chain must return a response object
- implementing :class:`pyramid.interfaces.IResponse` or raise an exception:
+ An important distinction is that each decorator will receive a response
+ object implementing :class:`pyramid.interfaces.IResponse` instead of the
+ raw value returned from the view callable. All decorators in the chain must
+ return a response object or raise an exception:
.. code-block:: python
diff --git a/docs/quick_tour.rst b/docs/quick_tour.rst
index 39b4cafb3..45c706b0d 100644
--- a/docs/quick_tour.rst
+++ b/docs/quick_tour.rst
@@ -504,7 +504,7 @@ Pyramid's ``pcreate`` command can list the available scaffolds:
.. code-block:: bash
- $ pcreate --list
+ $ $VENV/bin/pcreate --list
Available scaffolds:
alchemy: Pyramid project using SQLAlchemy, SQLite, URL dispatch, and Jinja2
pyramid_jinja2_starter: Pyramid Jinja2 starter project
@@ -517,7 +517,7 @@ that scaffold to make our project:
.. code-block:: bash
- $ pcreate --scaffold pyramid_jinja2_starter hello_world
+ $ $VENV/bin/pcreate --scaffold pyramid_jinja2_starter hello_world
We next use the normal Python command to set up our package for development:
@@ -678,10 +678,10 @@ egregious, as Pyramid has had a deep commitment to full test coverage since
before its release.
Our ``pyramid_jinja2_starter`` scaffold generated a ``tests.py`` module with
-one unit test in it. To run it, let's install the handy ``pytest`` test runner
-by editing ``setup.py``. While we're at it, we'll throw in the ``pytest-cov``
-tool which yells at us for code that isn't tested. Insert and edit the
-following lines as shown:
+one unit test in it. It also configured ``setup.py`` with test requirements:
+``py.test`` as the test runner, ``WebTest`` for running view tests, and the
+``pytest-cov`` tool which yells at us for code that isn't tested. The
+highlighted lines show this:
.. code-block:: python
:linenos:
@@ -711,7 +711,7 @@ following lines as shown:
'testing': tests_require,
},
-We changed ``setup.py`` which means we need to rerun ``$VENV/bin/pip install -e
+To install the test requirements, run ``$VENV/bin/pip install -e
".[testing]"``. We can now run all our tests:
.. code-block:: bash