summaryrefslogtreecommitdiff
path: root/docs/narr/viewconfig.rst
diff options
context:
space:
mode:
authorMichael Merickel <michael@merickel.org>2020-01-17 16:08:35 -0600
committerGitHub <noreply@github.com>2020-01-17 16:08:35 -0600
commit03d3bbd2791918a844da49eb4449b4953b83a31b (patch)
tree5899bebf50a3baf340b8fe650030c6a2b0525d0d /docs/narr/viewconfig.rst
parent9c153e1250e00faa06003c10c3a26886489e6210 (diff)
parent108f026e1dcca554867ff8f7a211a5ce0668a26e (diff)
downloadpyramid-03d3bbd2791918a844da49eb4449b4953b83a31b.tar.gz
pyramid-03d3bbd2791918a844da49eb4449b4953b83a31b.tar.bz2
pyramid-03d3bbd2791918a844da49eb4449b4953b83a31b.zip
Merge pull request #3560 from merwok/docs/rewrite-custom-predicates
Rewrite docs for custom predicates
Diffstat (limited to 'docs/narr/viewconfig.rst')
-rw-r--r--docs/narr/viewconfig.rst20
1 files changed, 12 insertions, 8 deletions
diff --git a/docs/narr/viewconfig.rst b/docs/narr/viewconfig.rst
index 6a49e02a5..5ba965def 100644
--- a/docs/narr/viewconfig.rst
+++ b/docs/narr/viewconfig.rst
@@ -317,6 +317,8 @@ Non-Predicate Arguments
.. versionadded:: 1.8
+.. _predicate_view_args:
+
Predicate Arguments
+++++++++++++++++++
@@ -506,21 +508,23 @@ configured view.
``custom_predicates``
If ``custom_predicates`` is specified, it must be a sequence of references to
- custom predicate callables. Use custom predicates when no set of predefined
- predicates do what you need. Custom predicates can be combined with
+ custom predicate callables. Custom predicates can be combined with
predefined predicates as necessary. Each custom predicate callable should
accept two arguments, ``context`` and ``request``, and should return either
``True`` or ``False`` after doing arbitrary evaluation of the context
resource and/or the request. If all callables return ``True``, the
associated view callable will be considered viable for a given request.
+ This parameter is kept around for backward compatibility.
- If ``custom_predicates`` is not specified, no custom predicates are used.
+ .. deprecated:: 1.5
+ See section below for new-style custom predicates.
-``predicates``
- Pass a key/value pair here to use a third-party predicate registered via
- :meth:`pyramid.config.Configurator.add_view_predicate`. More than one
- key/value pair can be used at the same time. See
- :ref:`view_and_route_predicates` for more information about third-party
+``**predicates``
+ Extra keyword parameters are used to invoke custom predicates, defined
+ in your app or by third-party packages extending Pyramid and registered via
+ :meth:`pyramid.config.Configurator.add_view_predicate`. Use custom predicates
+ when no set of predefined predicates do what you need. See
+ :ref:`view_and_route_predicates` for more information about custom
predicates.
.. versionadded:: 1.4a1