From 26d2d87bc2865a431b5eb30552c3eac4108b3a0c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89ric=20Araujo?= Date: Tue, 7 Jan 2020 14:33:31 -0500 Subject: rewrite docs for custom predicates --- src/pyramid/config/routes.py | 12 +++++++----- src/pyramid/config/views.py | 12 +++++++----- 2 files changed, 14 insertions(+), 10 deletions(-) (limited to 'src') diff --git a/src/pyramid/config/routes.py b/src/pyramid/config/routes.py index 44fbb9c46..cc3a87b2e 100644 --- a/src/pyramid/config/routes.py +++ b/src/pyramid/config/routes.py @@ -40,7 +40,7 @@ class RoutesConfiguratorMixin(object): inherit_slash=None, **predicates ): - """ Add a :term:`route configuration` to the current + r""" Add a :term:`route configuration` to the current configuration state, as well as possibly a :term:`view configuration` to be used to specify a :term:`view callable` that will be invoked when this route matches. The arguments @@ -283,6 +283,8 @@ class RoutesConfiguratorMixin(object): .. versionadded:: 1.4a4 + .. deprecated:: 2.0 + custom_predicates .. deprecated:: 1.5 @@ -302,14 +304,14 @@ class RoutesConfiguratorMixin(object): :ref:`custom_route_predicates` for more information about ``info``. - predicates + \*\*predicates - Pass a key/value pair here to use a third-party predicate + Pass extra keyword parameters to use custom or third-party predicates registered via :meth:`pyramid.config.Configurator.add_route_predicate`. More than - one key/value pair can be used at the same time. See + one custom predicate can be used at the same time. See :ref:`view_and_route_predicates` for more information about - third-party predicates. + custom predicates. .. versionadded:: 1.4 diff --git a/src/pyramid/config/views.py b/src/pyramid/config/views.py index 2cc5e8144..20f20b5e8 100644 --- a/src/pyramid/config/views.py +++ b/src/pyramid/config/views.py @@ -266,7 +266,7 @@ class ViewsConfiguratorMixin(object): exception_only=False, **view_options ): - """ Add a :term:`view configuration` to the current + r""" Add a :term:`view configuration` to the current configuration state. Arguments to ``add_view`` are broken down below into *predicate* arguments and *non-predicate* arguments. Predicate arguments narrow the circumstances in @@ -723,6 +723,8 @@ class ViewsConfiguratorMixin(object): .. versionadded:: 1.4a4 + .. deprecated:: 2.0 + custom_predicates .. deprecated:: 1.5 @@ -740,14 +742,14 @@ class ViewsConfiguratorMixin(object): obsoletes this argument, but it is kept around for backwards compatibility. - view_options + \*\*view_options - Pass a key/value pair here to use a third-party predicate or set a - value for a view deriver. See + Pass extra keyword parameters to use custom or third-party predicates + or set a value for a view deriver. See :meth:`pyramid.config.Configurator.add_view_predicate` and :meth:`pyramid.config.Configurator.add_view_deriver`. See :ref:`view_and_route_predicates` for more information about - third-party predicates and :ref:`view_derivers` for information + custom predicates and :ref:`view_derivers` for information about view derivers. .. versionadded: 1.4a1 -- cgit v1.2.3 From ad65078469770bc698b7b4a0a5634b3895aab971 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89ric=20Araujo?= Date: Sat, 11 Jan 2020 18:21:56 -0500 Subject: replace "third-party" with "custom" --- src/pyramid/config/routes.py | 5 ++--- src/pyramid/config/views.py | 15 ++++++--------- 2 files changed, 8 insertions(+), 12 deletions(-) (limited to 'src') diff --git a/src/pyramid/config/routes.py b/src/pyramid/config/routes.py index cc3a87b2e..a508f69a4 100644 --- a/src/pyramid/config/routes.py +++ b/src/pyramid/config/routes.py @@ -306,8 +306,7 @@ class RoutesConfiguratorMixin(object): \*\*predicates - Pass extra keyword parameters to use custom or third-party predicates - registered via + Pass extra keyword parameters to use custom predicates registered via :meth:`pyramid.config.Configurator.add_route_predicate`. More than one custom predicate can be used at the same time. See :ref:`view_and_route_predicates` for more information about @@ -323,7 +322,7 @@ class RoutesConfiguratorMixin(object): 'Configurator.add_route is deprecated as of Pyramid 1.5. ' 'Use "config.add_route_predicate" and use the registered ' 'route predicate as a predicate argument to add_route ' - 'instead. See "Adding A Third Party View, Route, or ' + 'instead. See "Adding A Custom View, Route, or ' 'Subscriber Predicate" in the "Hooks" chapter of the ' 'documentation for more information.' ), diff --git a/src/pyramid/config/views.py b/src/pyramid/config/views.py index 20f20b5e8..bbc4fc5bc 100644 --- a/src/pyramid/config/views.py +++ b/src/pyramid/config/views.py @@ -729,22 +729,19 @@ class ViewsConfiguratorMixin(object): .. deprecated:: 1.5 This value should 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 predefined predicates as necessary. - Each custom predicate callable should accept two arguments: + predicate callables. 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 and/or the request. The ``predicates`` argument - to this method and the ability to register third-party view - predicates via + the context and/or the request. The ability to register + custom view predicates via :meth:`pyramid.config.Configurator.add_view_predicate` obsoletes this argument, but it is kept around for backwards compatibility. \*\*view_options - Pass extra keyword parameters to use custom or third-party predicates + Pass extra keyword parameters to use custom predicates or set a value for a view deriver. See :meth:`pyramid.config.Configurator.add_view_predicate` and :meth:`pyramid.config.Configurator.add_view_deriver`. See @@ -771,7 +768,7 @@ class ViewsConfiguratorMixin(object): 'Configurator.add_view is deprecated as of Pyramid 1.5. ' 'Use "config.add_view_predicate" and use the registered ' 'view predicate as a predicate argument to add_view ' - 'instead. See "Adding A Third Party View, Route, or ' + 'instead. See "Adding A Custom View, Route, or ' 'Subscriber Predicate" in the "Hooks" chapter of the ' 'documentation for more information.' ), -- cgit v1.2.3 From c1e150d765e33d92ad4d6d5912207ce3ba20991e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89ric=20Araujo?= Date: Sat, 11 Jan 2020 18:22:21 -0500 Subject: remove obsolete bit --- src/pyramid/config/routes.py | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/pyramid/config/routes.py b/src/pyramid/config/routes.py index a508f69a4..4077ec96b 100644 --- a/src/pyramid/config/routes.py +++ b/src/pyramid/config/routes.py @@ -40,12 +40,9 @@ class RoutesConfiguratorMixin(object): inherit_slash=None, **predicates ): - r""" Add a :term:`route configuration` to the current - configuration state, as well as possibly a :term:`view - configuration` to be used to specify a :term:`view callable` - that will be invoked when this route matches. The arguments - to this method are divided into *predicate*, *non-predicate*, - and *view-related* types. :term:`Route predicate` arguments + r""" Add a :term:`route configuration` to the current configuration state. + The arguments to this method are divided into *predicate* and + *non-predicate* types. :term:`Route predicate` arguments narrow the circumstances in which a route will be match a request; non-predicate arguments are informational. -- cgit v1.2.3 From 04440d29082bbbae34fb76b9a8de083d1056e878 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89ric=20Araujo?= Date: Tue, 14 Jan 2020 17:05:02 -0500 Subject: apply more review fixes, minimize some diffs --- src/pyramid/config/routes.py | 10 +++++----- src/pyramid/config/views.py | 4 ++-- 2 files changed, 7 insertions(+), 7 deletions(-) (limited to 'src') diff --git a/src/pyramid/config/routes.py b/src/pyramid/config/routes.py index 4077ec96b..78e708d1e 100644 --- a/src/pyramid/config/routes.py +++ b/src/pyramid/config/routes.py @@ -40,10 +40,10 @@ class RoutesConfiguratorMixin(object): inherit_slash=None, **predicates ): - r""" Add a :term:`route configuration` to the current configuration state. - The arguments to this method are divided into *predicate* and - *non-predicate* types. :term:`Route predicate` arguments - narrow the circumstances in which a route will be match a + """ Add a :term:`route configuration` to the current configuration + state. Arguments to ``add_route`` are divided into *predicate* + and *non-predicate* types. :term:`Route predicate` arguments + narrow the circumstances in which a route will match a request; non-predicate arguments are informational. Non-Predicate Arguments @@ -301,7 +301,7 @@ class RoutesConfiguratorMixin(object): :ref:`custom_route_predicates` for more information about ``info``. - \*\*predicates + \\*\\*predicates Pass extra keyword parameters to use custom predicates registered via :meth:`pyramid.config.Configurator.add_route_predicate`. More than diff --git a/src/pyramid/config/views.py b/src/pyramid/config/views.py index bbc4fc5bc..c4fb54dd8 100644 --- a/src/pyramid/config/views.py +++ b/src/pyramid/config/views.py @@ -266,7 +266,7 @@ class ViewsConfiguratorMixin(object): exception_only=False, **view_options ): - r""" Add a :term:`view configuration` to the current + """ Add a :term:`view configuration` to the current configuration state. Arguments to ``add_view`` are broken down below into *predicate* arguments and *non-predicate* arguments. Predicate arguments narrow the circumstances in @@ -739,7 +739,7 @@ class ViewsConfiguratorMixin(object): obsoletes this argument, but it is kept around for backwards compatibility. - \*\*view_options + \\*\\*view_options Pass extra keyword parameters to use custom predicates or set a value for a view deriver. See -- cgit v1.2.3