Comment 5 for bug 1756360

Revision history for this message
Balazs Gibizer (balazs-gibizer) wrote :

Thanks for the extra information. Now I see that there is different behavior. Next I will try to see how the notifications look differently with the two versions.

(py27) ebalgib@elxa95hld12:~/upstream/git/oslo.serialization$ pip freeze | grep serialization
oslo.serialization==2.21.1
(py27) ebalgib@elxa95hld12:~/upstream/git/oslo.serialization$ python
Python 2.7.12 (default, Dec 4 2017, 14:50:18)
[GCC 5.4.0 20160609] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>>
>>>
>>> class MyException(Exception):
... def __init__(self, named_arg):
... super(MyException, self).__init__('message')
...
>>> from oslo_serialization import jsonutils
>>> print jsonutils.to_primitive(MyException(named_arg='alma'))
oslo_serialization/jsonutils.py:188: UserWarning: Cannot convert MyException('message',) to primitive, will raise ValueError instead of warning in version 3.0
  "instead of warning in version 3.0" % (value,))
message
>>> print jsonutils.to_primitive(MyException(named_arg='alma'), convert_instances=True)
{}
>>>

---

(py27) ebalgib@elxa95hld12:~/upstream/git/oslo.serialization$ pip freeze | grep serialization
oslo.serialization==2.25.1.dev1
(py27) ebalgib@elxa95hld12:~/upstream/git/oslo.serialization$ python
Python 2.7.12 (default, Dec 4 2017, 14:50:18)
[GCC 5.4.0 20160609] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> class MyException(Exception):
... def __init__(self, named_arg):
... super(MyException, self).__init__('message')
...
>>>
>>> from oslo_serialization import jsonutils
>>> print jsonutils.to_primitive(MyException(named_arg='alma'))
MyException('message',)
>>> print jsonutils.to_primitive(MyException(named_arg='alma'), convert_instances=True)
MyException('message',)
>>>

---