From d7c9f0a8190b5041f8efb7f83535d181f6499605 Mon Sep 17 00:00:00 2001 From: Bert JW Regeer Date: Sun, 14 Dec 2014 18:51:23 -0700 Subject: Move documentation for accept to non-predicate While accept is partially documented as a predicate, it is actually NOT a predicate in that the view machinery has all kinds of special cases for it. This also means that `not_` will not function on it correctly since it is not actually a predicate. --- pyramid/config/views.py | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/pyramid/config/views.py b/pyramid/config/views.py index c01b72e12..8ee7ca6c9 100644 --- a/pyramid/config/views.py +++ b/pyramid/config/views.py @@ -841,6 +841,17 @@ class ViewsConfiguratorMixin(object): very useful for 'civilians' who are just developing stock Pyramid applications. Pay no attention to the man behind the curtain. + accept + + The value of this argument represents a match query for one + or more mimetypes in the ``Accept`` HTTP request header. If + this value is specified, it must be in one of the following + forms: a mimetype match token in the form ``text/plain``, a + wildcard mimetype match token in the form ``text/*`` or a + match-all wildcard mimetype match token in the form ``*/*``. + If any of the forms matches the ``Accept`` header of the + request, this predicate will be true. + Predicate Arguments name @@ -941,17 +952,6 @@ class ViewsConfiguratorMixin(object): This is useful for detecting AJAX requests issued from jQuery, Prototype and other Javascript libraries. - accept - - The value of this argument represents a match query for one - or more mimetypes in the ``Accept`` HTTP request header. If - this value is specified, it must be in one of the following - forms: a mimetype match token in the form ``text/plain``, a - wildcard mimetype match token in the form ``text/*`` or a - match-all wildcard mimetype match token in the form ``*/*``. - If any of the forms matches the ``Accept`` header of the - request, this predicate will be true. - header This value represents an HTTP header name or a header -- cgit v1.2.3 From 63366c3ddf353bbd2a237875f0c42e8f470c31c7 Mon Sep 17 00:00:00 2001 From: Bert JW Regeer Date: Sun, 14 Dec 2014 18:56:33 -0700 Subject: Update CHANGES --- CHANGES.txt | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/CHANGES.txt b/CHANGES.txt index 22c7a20c2..b2f56e02e 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -130,6 +130,12 @@ Deprecations Docs ---- +- Moved the documentation for ``accept`` on ``Configurator.add_view`` to no + longer be part of the decorator list. See + https://github.com/Pylons/pyramid/issues/1391 for a bug report stating + ``not_`` was failing on ``accept``. Discussion with @mcdonc led to the + conclusion that it should not be documented as a predicate. + - Removed logging configuration from Quick Tutorial ini files except for scaffolding- and logging-related chapters to avoid needing to explain it too early. -- cgit v1.2.3 From 958c4c7de27b3353dab6e2a7552a17321236c138 Mon Sep 17 00:00:00 2001 From: Bert JW Regeer Date: Sun, 14 Dec 2014 19:21:55 -0700 Subject: Update add_route accept to non-predicate --- pyramid/config/routes.py | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/pyramid/config/routes.py b/pyramid/config/routes.py index 509955cdd..c6e8fe563 100644 --- a/pyramid/config/routes.py +++ b/pyramid/config/routes.py @@ -138,6 +138,19 @@ class RoutesConfiguratorMixin(object): .. versionadded:: 1.1 + accept + + This value represents a match query for one or more + mimetypes in the ``Accept`` HTTP request header. If this + value is specified, it must be in one of the following + forms: a mimetype match token in the form ``text/plain``, a + wildcard mimetype match token in the form ``text/*`` or a + match-all wildcard mimetype match token in the form ``*/*``. + If any of the forms matches the ``Accept`` header of the + request, or if the ``Accept`` header isn't set at all in the + request, this predicate will be true. If this predicate + returns ``False``, route matching continues. + Predicate Arguments pattern @@ -220,19 +233,6 @@ class RoutesConfiguratorMixin(object): case of the header name is not significant. If this predicate returns ``False``, route matching continues. - accept - - This value represents a match query for one or more - mimetypes in the ``Accept`` HTTP request header. If this - value is specified, it must be in one of the following - forms: a mimetype match token in the form ``text/plain``, a - wildcard mimetype match token in the form ``text/*`` or a - match-all wildcard mimetype match token in the form ``*/*``. - If any of the forms matches the ``Accept`` header of the - request, or if the ``Accept`` header isn't set at all in the - request, this predicate will be true. If this predicate - returns ``False``, route matching continues. - effective_principals If specified, this value should be a :term:`principal` identifier or -- cgit v1.2.3 From c015da76f51304a5186909f01a7850de073eabdc Mon Sep 17 00:00:00 2001 From: Bert JW Regeer Date: Sun, 14 Dec 2014 19:56:25 -0700 Subject: Fix typo --- CHANGES.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGES.txt b/CHANGES.txt index b2f56e02e..d3788afa5 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -131,7 +131,7 @@ Docs ---- - Moved the documentation for ``accept`` on ``Configurator.add_view`` to no - longer be part of the decorator list. See + longer be part of the predicate list. See https://github.com/Pylons/pyramid/issues/1391 for a bug report stating ``not_`` was failing on ``accept``. Discussion with @mcdonc led to the conclusion that it should not be documented as a predicate. -- cgit v1.2.3 From da1f208369607a755be4ad355df07fac0bc7719d Mon Sep 17 00:00:00 2001 From: Bert JW Regeer Date: Thu, 5 Feb 2015 23:12:36 -0700 Subject: Remove all signs of predicate While this is somewhat a predicate, it really isn't for all intents and purposes because it is treated special. Make sure we document it that way. --- pyramid/config/routes.py | 19 +++++++++---------- pyramid/config/views.py | 17 +++++++++-------- 2 files changed, 18 insertions(+), 18 deletions(-) diff --git a/pyramid/config/routes.py b/pyramid/config/routes.py index c6e8fe563..24f38a4fd 100644 --- a/pyramid/config/routes.py +++ b/pyramid/config/routes.py @@ -140,16 +140,15 @@ class RoutesConfiguratorMixin(object): accept - This value represents a match query for one or more - mimetypes in the ``Accept`` HTTP request header. If this - value is specified, it must be in one of the following - forms: a mimetype match token in the form ``text/plain``, a - wildcard mimetype match token in the form ``text/*`` or a - match-all wildcard mimetype match token in the form ``*/*``. - If any of the forms matches the ``Accept`` header of the - request, or if the ``Accept`` header isn't set at all in the - request, this predicate will be true. If this predicate - returns ``False``, route matching continues. + This value represents a match query for one or more mimetypes in the + ``Accept`` HTTP request header. If this value is specified, it must + be in one of the following forms: a mimetype match token in the form + ``text/plain``, a wildcard mimetype match token in the form + ``text/*`` or a match-all wildcard mimetype match token in the form + ``*/*``. If any of the forms matches the ``Accept`` header of the + request, or if the ``Accept`` header isn't set at all in the request, + this will match the current route. If this does not match the + ``Accept`` header of the request, route matching continues. Predicate Arguments diff --git a/pyramid/config/views.py b/pyramid/config/views.py index 8ee7ca6c9..1f69d7e0b 100644 --- a/pyramid/config/views.py +++ b/pyramid/config/views.py @@ -843,14 +843,15 @@ class ViewsConfiguratorMixin(object): accept - The value of this argument represents a match query for one - or more mimetypes in the ``Accept`` HTTP request header. If - this value is specified, it must be in one of the following - forms: a mimetype match token in the form ``text/plain``, a - wildcard mimetype match token in the form ``text/*`` or a - match-all wildcard mimetype match token in the form ``*/*``. - If any of the forms matches the ``Accept`` header of the - request, this predicate will be true. + This value represents a match query for one or more mimetypes in the + ``Accept`` HTTP request header. If this value is specified, it must + be in one of the following forms: a mimetype match token in the form + ``text/plain``, a wildcard mimetype match token in the form + ``text/*`` or a match-all wildcard mimetype match token in the form + ``*/*``. If any of the forms matches the ``Accept`` header of the + request, or if the ``Accept`` header isn't set at all in the request, + this will match the current view. If this does not match the + ``Accept`` header of the request, view matching continues. Predicate Arguments -- cgit v1.2.3 From f176630ebd9848173e6cc748f361b4ce9acf76f3 Mon Sep 17 00:00:00 2001 From: Bert JW Regeer Date: Thu, 5 Feb 2015 23:15:51 -0700 Subject: Add link to PR --- CHANGES.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGES.txt b/CHANGES.txt index d3788afa5..832a2c216 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -135,6 +135,7 @@ Docs https://github.com/Pylons/pyramid/issues/1391 for a bug report stating ``not_`` was failing on ``accept``. Discussion with @mcdonc led to the conclusion that it should not be documented as a predicate. + See https://github.com/Pylons/pyramid/pull/1487 for this PR - Removed logging configuration from Quick Tutorial ini files except for scaffolding- and logging-related chapters to avoid needing to explain it too -- cgit v1.2.3