summaryrefslogtreecommitdiff
path: root/docs/narr/viewconfig.rst
diff options
context:
space:
mode:
authorBert JW Regeer <bertjw@regeer.org>2013-09-05 22:26:10 -0600
committerBert JW Regeer <bertjw@regeer.org>2013-09-05 22:26:10 -0600
commite8b1cf5dbb6353c0eead76996d1c002440bd6b89 (patch)
treec33eb4eec81f288f48242ae1f272b0b896556518 /docs/narr/viewconfig.rst
parent89917f6e0323777bf8fa2c94ae81c7ebf6ad7a6d (diff)
parent027c9809ca9377b3ae37a34e4ed997d8fdfddfb8 (diff)
downloadpyramid-e8b1cf5dbb6353c0eead76996d1c002440bd6b89.tar.gz
pyramid-e8b1cf5dbb6353c0eead76996d1c002440bd6b89.tar.bz2
pyramid-e8b1cf5dbb6353c0eead76996d1c002440bd6b89.zip
Merge branch 'master' into feature/split_chameleon_from_pyramid
Conflicts: pyramid/tests/test_renderers.py
Diffstat (limited to 'docs/narr/viewconfig.rst')
-rw-r--r--docs/narr/viewconfig.rst59
1 files changed, 30 insertions, 29 deletions
diff --git a/docs/narr/viewconfig.rst b/docs/narr/viewconfig.rst
index e09fd83ab..76cf1daac 100644
--- a/docs/narr/viewconfig.rst
+++ b/docs/narr/viewconfig.rst
@@ -465,6 +465,36 @@ configured view.
.. versionadded:: 1.4a1
+Inverting Predicate Values
+++++++++++++++++++++++++++
+
+You can invert the meaning of any predicate value by wrapping it in a call to
+:class:`pyramid.config.not_`.
+
+.. code-block:: python
+ :linenos:
+
+ from pyramid.config import not_
+
+ config.add_view(
+ 'mypackage.views.my_view',
+ route_name='ok',
+ request_method=not_('POST')
+ )
+
+The above example will ensure that the view is called if the request method
+is *not* ``POST``, at least if no other view is more specific.
+
+This technique of wrapping a predicate value in ``not_`` can be used anywhere
+predicate values are accepted:
+
+- :meth:`pyramid.config.Configurator.add_view`
+
+- :meth:`pyramid.view.view_config`
+
+.. versionadded:: 1.5
+
+
.. index::
single: view_config decorator
@@ -557,35 +587,6 @@ form of :term:`declarative configuration`, while
:meth:`pyramid.config.Configurator.add_view` is a form of :term:`imperative
configuration`. However, they both do the same thing.
-Inverting Predicate Values
-~~~~~~~~~~~~~~~~~~~~~~~~~~
-
-You can invert the meaning of any predicate value by wrapping it in a call to
-:class:`pyramid.config.not_`.
-
-.. code-block:: python
- :linenos:
-
- from pyramid.config import not_
-
- config.add_view(
- 'mypackage.views.my_view',
- route_name='ok',
- request_method=not_('POST')
- )
-
-The above example will ensure that the view is called if the request method
-is *not* ``POST``, at least if no other view is more specific.
-
-This technique of wrapping a predicate value in ``not_`` can be used anywhere
-predicate values are accepted:
-
-- :meth:`pyramid.config.Configurator.add_view`
-
-- :meth:`pyramid.view.view_config`
-
-.. versionadded:: 1.5
-
.. index::
single: view_config placement