summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Merickel <michael@merickel.org>2018-10-10 00:18:28 -0500
committerMichael Merickel <michael@merickel.org>2018-10-10 00:18:28 -0500
commit4cc3a67060f22bb11d037bd44a24112efca6d507 (patch)
tree3ff67391fd8836070eeb95c24b786a76c18ae7cb
parent4a9f4f43684c3a754f43935b97013057340c305d (diff)
downloadpyramid-4cc3a67060f22bb11d037bd44a24112efca6d507.tar.gz
pyramid-4cc3a67060f22bb11d037bd44a24112efca6d507.tar.bz2
pyramid-4cc3a67060f22bb11d037bd44a24112efca6d507.zip
fix up the docs
-rw-r--r--docs/narr/viewconfig.rst31
-rw-r--r--pyramid/config/routes.py16
-rw-r--r--pyramid/config/views.py47
3 files changed, 52 insertions, 42 deletions
diff --git a/docs/narr/viewconfig.rst b/docs/narr/viewconfig.rst
index 238599528..4c8427d98 100644
--- a/docs/narr/viewconfig.rst
+++ b/docs/narr/viewconfig.rst
@@ -285,6 +285,23 @@ Non-Predicate Arguments
are just developing stock Pyramid applications. Pay no attention to the man
behind the curtain.
+``accept``
+ A :term:`media type` that will be matched against the ``Accept`` HTTP request header.
+ If this value is specified, it must be a specific media type such as ``text/html`` or ``text/html;level=1``.
+ If the media type is acceptable by the ``Accept`` header of the request, or if the ``Accept`` header isn't set at all in the request, this predicate will match.
+ If this does not match the ``Accept`` header of the request, view matching continues.
+
+ If ``accept`` is not specified, the ``HTTP_ACCEPT`` HTTP header is not taken into consideration when deciding whether or not to invoke the associated view callable.
+
+ The ``accept`` argument is technically not a predicate and does not support wrapping with :func:`pyramid.config.not_`.
+
+ See :ref:`accept_content_negotiation` for more information.
+
+ .. versionchanged:: 1.10
+
+ Specifying a media range is deprecated and will be removed in :app:`Pyramid` 2.0.
+ Use explicit media types to avoid any ambiguities in content negotiation.
+
``exception_only``
When this value is ``True``, the ``context`` argument must be a subclass of
@@ -344,20 +361,6 @@ configured view.
request/context pair found via :term:`resource location` does not indicate it
matched any configured route.
-``accept``
- A :term:`media type` that will be matched against the ``Accept`` HTTP request header.
- If this value is specified, it must be a specific media type, such as ``text/html``.
- If the media type is acceptable by the ``Accept`` header of the request, or if the ``Accept`` header isn't set at all in the request, this predicate will match.
- If this does not match the ``Accept`` header of the request, view matching continues.
-
- If ``accept`` is not specified, the ``HTTP_ACCEPT`` HTTP header is not taken into consideration when deciding whether or not to invoke the associated view callable.
-
- See :ref:`accept_content_negotiation` for more information.
-
- .. versionchanged:: 1.10
- Media ranges such as ``text/*`` will now raise :class:`pyramid.exceptions.ConfigurationError`.
- Previously these values had undefined behavior based on the version of WebOb being used and was never fully supported.
-
``request_type``
This value should be an :term:`interface` that the :term:`request` must
provide in order for this view to be found and called.
diff --git a/pyramid/config/routes.py b/pyramid/config/routes.py
index 4d1f830c8..832fd3f8b 100644
--- a/pyramid/config/routes.py
+++ b/pyramid/config/routes.py
@@ -228,17 +228,21 @@ class RoutesConfiguratorMixin(object):
accept
A :term:`media type` that will be matched against the ``Accept``
- HTTP request header. This value may be a specific media type such
- as ``text/html``, or a list of the same. If the media type is
- acceptable by the ``Accept`` header of the request, or if the
- ``Accept`` header isn't set at all in the request, this predicate
- will match. If this does not match the ``Accept`` header of the
- request, route matching continues.
+ HTTP request header. If this value is specified, it may be a
+ specific media type such as ``text/html``, or a list of the same.
+ If the media type is acceptable by the ``Accept`` header of the
+ request, or if the ``Accept`` header isn't set at all in the request,
+ this predicate will match. If this does not match the ``Accept``
+ header of the request, route matching continues.
If ``accept`` is not specified, the ``HTTP_ACCEPT`` HTTP header is
not taken into consideration when deciding whether or not to select
the route.
+ Unlike the ``accept`` argument to
+ :meth:`pyramid.config.Configurator.add_view`, this value is
+ strictly a predicate and supports :func:`pyramid.config.not_`.
+
.. versionchanged:: 1.10
Specifying a media range is deprecated due to changes in WebOb
diff --git a/pyramid/config/views.py b/pyramid/config/views.py
index ca299c4b5..8d542a8a1 100644
--- a/pyramid/config/views.py
+++ b/pyramid/config/views.py
@@ -542,6 +542,31 @@ class ViewsConfiguratorMixin(object):
very useful for 'civilians' who are just developing stock Pyramid
applications. Pay no attention to the man behind the curtain.
+ accept
+
+ A :term:`media type` that will be matched against the ``Accept``
+ HTTP request header. If this value is specified, it must be a
+ specific media type such as ``text/html`` or ``text/html;level=1``.
+ If the media type is acceptable by the ``Accept`` header of the
+ request, or if the ``Accept`` header isn't set at all in the request,
+ this predicate will match. If this does not match the ``Accept``
+ header of the request, view matching continues.
+
+ If ``accept`` is not specified, the ``HTTP_ACCEPT`` HTTP header is
+ not taken into consideration when deciding whether or not to invoke
+ the associated view callable.
+
+ The ``accept`` argument is technically not a predicate and does
+ not support wrapping with :func:`pyramid.config.not_`.
+
+ See :ref:`accept_content_negotiation` for more information.
+
+ .. versionchanged:: 1.10
+
+ Specifying a media range is deprecated and will be removed in
+ :app:`Pyramid` 2.0. Use explicit media types to avoid any
+ ambiguities in content negotiation.
+
exception_only
.. versionadded:: 1.8
@@ -674,28 +699,6 @@ class ViewsConfiguratorMixin(object):
represents a header name or a header name/value pair, the
case of the header name is not significant.
- accept
-
- A :term:`media type` that will be matched against the ``Accept``
- HTTP request header. This value must be a specific media type such
- as ``text/html`` or ``text/html;level=1``. If the media type is
- acceptable by the ``Accept`` header of the request, or if the
- ``Accept`` header isn't set at all in the request, this predicate
- will match. If this does not match the ``Accept`` header of the
- request, view matching continues.
-
- If ``accept`` is not specified, the ``HTTP_ACCEPT`` HTTP header is
- not taken into consideration when deciding whether or not to invoke
- the associated view callable.
-
- See :ref:`accept_content_negotiation` for more information.
-
- .. versionchanged:: 1.10
-
- Specifying a media range is deprecated and will be removed in
- :app:`Pyramid` 2.0. Use explicit media types to avoid any
- ambiguities in content negotiation.
-
path_info
This value represents a regular expression pattern that will