Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ClassicUI] Error exporting collections because include_items is always True (deserialization error) #243

Open
yurj opened this issue Jun 12, 2024 · 0 comments

Comments

@yurj
Copy link

yurj commented Jun 12, 2024

Hi!

If I try to export a collection, I get:

2024-06-12 09:04:04,171 ERROR   [collective.exportimport.export_content:379][waitress-1] Error exporting http://localhost:9080/xxxmycoll
Traceback (most recent call last):
  File "/aaa/buildout-cache/eggs/plone.restapi-9.6.1-py3.11.egg/plone/restapi/deserializer/__init__.py", line 11, in json_body
    data = json.loads(request.get("BODY") or "{}")
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/yurj/.pyenv/versions/3.11.9/lib/python3.11/json/__init__.py", line 346, in loads
    return _default_decoder.decode(s)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/yurj/.pyenv/versions/3.11.9/lib/python3.11/json/decoder.py", line 337, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/yurj/.pyenv/versions/3.11.9/lib/python3.11/json/decoder.py", line 355, in raw_decode
    raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/aaa/buildout-cache/eggs/collective.exportimport-1.12-py3.11.egg/collective/exportimport/export_content.py", line 372, in export_content
    item = serializer()
           ^^^^^^^^^^^^
  File "/aaa/buildout-cache/eggs/plone.restapi-9.6.1-py3.11.egg/plone/restapi/serializer/collection.py", line 23, in __call__
    batch = HypermediaBatch(self.request, results)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/aaa/buildout-cache/eggs/plone.restapi-9.6.1-py3.11.egg/plone/restapi/batching.py", line 14, in __init__
    self.b_start = int(json_body(self.request).get("b_start", False)) or int(
                       ^^^^^^^^^^^^^^^^^^^^^^^
  File "/aaa/buildout-cache/eggs/plone.restapi-9.6.1-py3.11.egg/plone/restapi/deserializer/__init__.py", line 13, in json_body
    raise DeserializationError("No JSON object could be decoded")
plone.restapi.exceptions.DeserializationError: 'No JSON object could be decoded'

The problem seems here (

elif getattr(aq_base(obj), "isPrincipiaFolderish", False):
item = serializer(include_items=False)
else:
item = serializer()
) :

the BODY seems a multipart and not a JSON.

So we have 2 issue:

  • multipart instead of JSON
  • include_items always set to True for Collections
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant