From 2a69c7b60069d5c6de7a49436c26dd329f310fea Mon Sep 17 00:00:00 2001 From: Michael Merickel <michael@merickel.org> Date: Wed, 10 Oct 2018 09:13:02 +0200 Subject: [PATCH] sentence-per-line --- docs/narr/viewconfig.rst | 11 +++++++++-- 1 files changed, 9 insertions(+), 2 deletions(-) diff --git a/docs/narr/viewconfig.rst b/docs/narr/viewconfig.rst index 4c8427d..f756fa1 100644 --- a/docs/narr/viewconfig.rst +++ b/docs/narr/viewconfig.rst @@ -1099,14 +1099,21 @@ For any set of media type offers with the same ``type/subtype``, the offers with params will weigh more than the bare ``type/subtype`` offer. This means that ``text/plain;charset=utf8`` will always be offered before ``text/plain``. -By default, within a given ``type/subtype``, the order of offers is ambiguous. For example, ``text/plain;charset=utf8`` versus ``text/plain;charset=latin1`` are sorted in an unspecified way. Similarly, between media types the order is also unspecified other than the defaults described below. For example, ``image/jpeg`` versus ``image/png`` versus ``application/pdf``. In these cases, the ordering may be controlled using :meth:`pyramid.config.Configurator.add_accept_view_order`. For example, to sort ``text/plain`` higher than ``text/html`` and to prefer a ``charset=utf8`` versus a ``charset=latin-1`` within the ``text/plain`` media type: +By default, within a given ``type/subtype``, the order of offers is ambiguous. +For example, ``text/plain;charset=utf8`` versus ``text/plain;charset=latin1`` are sorted in an unspecified way. +Similarly, between media types the order is also unspecified other than the defaults described below. +For example, ``image/jpeg`` versus ``image/png`` versus ``application/pdf``. +In these cases, the ordering may be controlled using :meth:`pyramid.config.Configurator.add_accept_view_order`. +For example, to sort ``text/plain`` higher than ``text/html`` and to prefer a ``charset=utf8`` versus a ``charset=latin-1`` within the ``text/plain`` media type: .. code-block:: python config.add_accept_view_order('text/plain', weighs_more_than='text/html') config.add_accept_view_order('text/plain;charset=utf8', weighs_more_than='text/plain;charset=latin-1') -It is an error to try and sort accept headers across levels of specificity. You can only sort a ``type/subtype`` against another ``type/subtype``, not against a ``type/subtype;params``. That ordering is a hard requirement. +It is an error to try and sort accept headers across levels of specificity. +You can only sort a ``type/subtype`` against another ``type/subtype``, not against a ``type/subtype;params``. +That ordering is a hard requirement. By default, :app:`Pyramid` defines a very simple priority ordering for views that prefers human-readable responses over JSON: -- Gitblit v1.9.3