You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Recently there was a change to deserializing when importing a new item. Now the item data is converted to a json string before the deserializer using json.dumps. This causes issues when deserializing decimal values however. So i was wondering why this change was made and if this change could be reverted?
The text was updated successfully, but these errors were encountered:
The reason is that not all deserializers support the data=item format and the default seems to be to use json_body(self.request) (e.g. https://github.com/plone/plone.restapi/blob/master/src/plone/restapi/deserializer/site.py#L37).
So reverting this will break importing the site-root. I have not had to deal with decimals so far. Please tell me if you find another solution.
Traceback (most recent call last):
File "/app/lib/python3.11/site-packages/collective/exportimport/import_content.py", line 409, in import_new_content
new = self.handle_new_object(item, index, new)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/app/lib/python3.11/site-packages/collective/exportimport/import_content.py", line 430, in handle_new_object
self.request["BODY"] = json.dumps(item)
^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/json/__init__.py", line 231, in dumps
return _default_encoder.encode(obj)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/json/encoder.py", line 200, in encode
chunks = self.iterencode(o, _one_shot=True)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/json/encoder.py", line 258, in iterencode
return _iterencode(o, 0)
^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/json/encoder.py", line 180, in default
raise TypeError(f'Object of type {o.__class__.__name__} '
TypeError: Object of type Decimal is not JSON serializable
Recently there was a change to deserializing when importing a new item. Now the item data is converted to a json string before the deserializer using json.dumps. This causes issues when deserializing decimal values however. So i was wondering why this change was made and if this change could be reverted?
The text was updated successfully, but these errors were encountered: