plone / plone.api

The Plone API
https://6.docs.plone.org/plone.api
Other
86 stars 53 forks source link

`plone.api.relation.create` error on not required RelationList field #534

Closed szakitibi closed 4 months ago

szakitibi commented 4 months ago

Steps to reproduce

    some_related_stuff = RelationList(
        title="Some not required related stuff",
        value_type=RelationChoice(vocabulary='plone.app.vocabularies.Catalog'),
        required=False,
    )
api.relation.create(source=obj1, target=obj2, relationship='some_related_stuff')

What happens

It goes into an error, since it gets None here:

https://github.com/plone/plone.api/blob/08884b755450cdc5290d640b826d3f659025179f/src/plone/api/relation.py#L220

What I expect

A relation created.