Error on serializing zope.schema.List field
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 109
- Forks
- 107
- Avg merge
- 2d 3h
- Merged PRs (30d)
- 4
Description
Hi,
I am using the Plone 5.2.2 Setup with
plone.restapi = 6.13.7 and
plone.app.vocabularies = 4.2.0
When requesting a certain object with fullobject=1 parameter via restapi, the plone.restapi plugin throws an exception with the following stack trace:
Module ZPublisher.WSGIPublisher, line 162, in transaction_pubevents
Module ZPublisher.WSGIPublisher, line 359, in publish_module
Module ZPublisher.WSGIPublisher, line 262, in publish
Module ZPublisher.mapply, line 85, in mapply
Module ZPublisher.WSGIPublisher, line 63, in call_object
Module plone.rest.service, line 22, in __call__
Module plone.restapi.services, line 21, in render
Module plone.restapi.services.content.get, line 18, in reply
Module plone.restapi.serializer.dxcontent, line 161, in __call__
Module plone.restapi.serializer.dxcontent, line 94, in __call__
Module plone.restapi.serializer.dxfields, line 80, in __call__
AttributeError: 'CatalogVocabulary' object has no attribute 'getTerm'
The schema definition is as follows:
from zope.schema import List
from z3c.relationfield.schema import RelationChoice
from plone.app.vocabularies.catalog import CatalogSource
class ITopic(model.Schema):
topics = List(
title=_(u'topics.title', u'Topics'),
required=True,
min_length=1,
value_type=RelationChoice(source=CatalogSource(portal_type=['Topics'])),
)
Can anyone help me please? Many thanks in advance.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at the plone.restapi.serializer.dxfields entry point shown in the traceback and reproduce the request with fullobject=1 against the schema's List field using CatalogSource. Trace how the CatalogVocabulary is handled during serialization; done means the request completes without the getTerm AttributeError and the list field is serialized.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- api, backend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100