Skip to content

Commit

Permalink
Update upgrading docs
Browse files Browse the repository at this point in the history
  • Loading branch information
leplatrem committed May 19, 2020
1 parent 3f4640e commit 653e93d
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 0 deletions.
4 changes: 4 additions & 0 deletions CHANGES.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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 <https://cornice.readthedocs.io/en/stable/upgrading.html>`_ for detailed migration instructions.


4.0.1 (2019-12-02)
==================
Expand Down
29 changes: 29 additions & 0 deletions docs/source/upgrading.rst
Original file line number Diff line number Diff line change
@@ -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
==========

Expand Down

0 comments on commit 653e93d

Please sign in to comment.