Victor Stinner cdb2f60d26 jsonutils.to_primitive(): add fallback parameter
For example, to_primitive(fallback=repr) can be used to prevent
serialialization error like "ValueError: Circular reference detected"
when using the JSONFormatter of oslo.log.

If fallback is set, it is also used to convert itertools.count(),
"nasty" objects like types, and to handle TypeError.

Use fallback=six.text_type to convert objects to text.

This patch doesn't change the default behaviour.

Related-Bug: #1593641
Change-Id: Ie0f7f2d09355c3d2a9f7c5ee8f7e02dfea3b073b
2017-09-26 11:20:08 +02:00
2017-07-28 21:05:30 +00:00
2016-12-20 14:36:50 +11:00
2017-03-16 15:01:15 +00:00
2017-03-03 00:03:20 +00:00
2017-01-17 10:34:52 -08:00

Team and repository tags

image

oslo.serialization

Latest Version

Downloads

The oslo.serialization library provides support for representing objects in transmittable and storable formats, such as Base64, JSON and MessagePack.

Description
OpenStack library for serialization
Readme 3.4 MiB
Languages
Python 100%