From 3f4640e3b57d139ab58a1e2f300650c20eaefbae Mon Sep 17 00:00:00 2001 From: Mathieu Leplatre Date: Tue, 19 May 2020 12:02:38 +0200 Subject: [PATCH 1/2] Preparing release 5.0.0 --- CHANGES.txt | 2 +- setup.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/CHANGES.txt b/CHANGES.txt index 4498718d..3b4d7804 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -2,7 +2,7 @@ CHANGELOG ######### -4.1.0 (unreleased) +5.0.0 (2020-05-19) ================== **Breaking Changes** diff --git a/setup.py b/setup.py index d84fc37e..e4f74162 100755 --- a/setup.py +++ b/setup.py @@ -15,7 +15,7 @@ package_data = {} setup(name='cornice', - version='4.1.0.dev0', + version='5.0.0', description='Define Web Services in Pyramid.', long_description=README + '\n\n' + CHANGES, license='MPLv2.0', From 653e93dffe88bd6a6e7aaf5d7c305ed33c7d5fe9 Mon Sep 17 00:00:00 2001 From: Mathieu Leplatre Date: Tue, 19 May 2020 12:55:54 +0200 Subject: [PATCH 2/2] Update upgrading docs --- CHANGES.txt | 4 ++++ docs/source/upgrading.rst | 29 +++++++++++++++++++++++++++++ 2 files changed, 33 insertions(+) diff --git a/CHANGES.txt b/CHANGES.txt index 3b4d7804..beee4668 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -8,6 +8,10 @@ CHANGELOG **Breaking Changes** - Drop Python 2 support +- The default JSON renderer does not use ``simplejson.dumps()`` by default anymore, so the requirement has been dropped. + +Please refer to `upgrading docs `_ for detailed migration instructions. + 4.0.1 (2019-12-02) ================== diff --git a/docs/source/upgrading.rst b/docs/source/upgrading.rst index f391f60e..75d55db9 100644 --- a/docs/source/upgrading.rst +++ b/docs/source/upgrading.rst @@ -1,6 +1,35 @@ Upgrading ######### +4.X to 5.X +========== + +Upgrade your codebase to Python 3. + +In order to keep using ``simplejson`` with this release, add it explicitly as your project dependencies, and set it explicitly as the default renderer: + +.. code-block:: python + + import simplejson + from cornice.render import CorniceRenderer + + class SimpleJSONRenderer(CorniceRenderer): + def __init__(self, **kwargs): + kwargs["serializer"] = simplejson.dumps + + config.add_renderer(None, SimpleJSONRenderer()) + +See https://docs.pylonsproject.org/projects/pyramid/en/latest/narr/renderers.html + + +3.X to 4.X +========== + +``request.validated`` is now always a ``colander.MappingSchema`` instance (``dict``) when using ``colander_*_validator()`` functions. + +In order to use a different type (eg. ``SequenceSchema``), use ``colander_validator()`` and read it from ``request.validated['body']``. + + 2.X to 3.X ==========