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

Batch request to /@registry fails with json serilazation issue #1657

Open
Sakoes opened this issue Jun 14, 2023 · 1 comment
Open

Batch request to /@registry fails with json serilazation issue #1657

Sakoes opened this issue Jun 14, 2023 · 1 comment

Comments

@Sakoes
Copy link

Sakoes commented Jun 14, 2023

When sending requests to the /@registry endpoint to retrieve registry options. The request fails when there is a json serialization issue in only one of the registry options.

$ curl http://localhost:6003/Plone/@registry\?b_size\=3226 -H "Accept: application/json" --user admin:admin

{
  "message": "Object of type datetime is not JSON serializable",
  "traceback": [
    "File \"/buildout/eggs/Zope-5.7-py3.8.egg/ZPublisher/WSGIPublisher.py\", line 167, in transaction_pubevents",
    "    yield",
    "",
    "  File \"/buildout/eggs/Zope-5.7-py3.8.egg/ZPublisher/WSGIPublisher.py\", line 376, in publish_module",
    "    response = _publish(request, new_mod_info)",
    "",
    "  File \"/buildout/eggs/Zope-5.7-py3.8.egg/ZPublisher/WSGIPublisher.py\", line 271, in publish",
    "    result = mapply(obj,",
    "",
    "  File \"/buildout/eggs/Zope-5.7-py3.8.egg/ZPublisher/mapply.py\", line 85, in mapply",
    "    return debug(object, args, context)",
    "",
    "  File \"/buildout/eggs/Zope-5.7-py3.8.egg/ZPublisher/WSGIPublisher.py\", line 68, in call_object",
    "    return obj(*args)",
    "",
    "  File \"/buildout/eggs/plone.rest-2.0.0-py3.8.egg/plone/rest/service.py\", line 22, in __call__",
    "    return self.render()",
    "",
    "  File \"/buildout/eggs/plone.restapi-8.32.6-py3.8.egg/plone/restapi/services/__init__.py\", line 22, in render",
    "    return json.dumps(",
    "",
    "  File \"/usr/lib64/python3.8/json/__init__.py\", line 234, in dumps",
    "    return cls(",
    "",
    "  File \"/usr/lib64/python3.8/json/encoder.py\", line 201, in encode",
    "    chunks = list(chunks)",
    "",
    "  File \"/usr/lib64/python3.8/json/encoder.py\", line 431, in _iterencode",
    "    yield from _iterencode_dict(o, _current_indent_level)",
    "",
    "  File \"/usr/lib64/python3.8/json/encoder.py\", line 405, in _iterencode_dict",
    "    yield from chunks",
    "",
    "  File \"/usr/lib64/python3.8/json/encoder.py\", line 325, in _iterencode_list",
    "    yield from chunks",
    "",
    "  File \"/usr/lib64/python3.8/json/encoder.py\", line 405, in _iterencode_dict",
    "    yield from chunks",
    "",
    "  File \"/usr/lib64/python3.8/json/encoder.py\", line 405, in _iterencode_dict",
    "    yield from chunks",
    "",
    "  File \"/usr/lib64/python3.8/json/encoder.py\", line 405, in _iterencode_dict",
    "    yield from chunks",
    "",
    "  File \"/usr/lib64/python3.8/json/encoder.py\", line 438, in _iterencode",
    "    o = _default(o)",
    "",
    "  File \"/usr/lib64/python3.8/json/encoder.py\", line 179, in default",
    "    raise TypeError(f'Object of type {o.__class__.__name__} '"
  ],
  "type": "TypeError"
}
@davisagli
Copy link
Member

What would you expect to happen instead?

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

2 participants