Plone 5.2 RC5 Issue with RelationChoice field

@cekk and I have independently run into the following issue. I may have stumbled on a possible solution, looking for guidance from the community. Also described in this Github issue.

When adding a Dexterity content type which includes a RelationChoice field in conjunction with the IDublinCore behavior creators (possibly also contributors), the following error occurs:

Module plone.app.vocabularies.principals, line 113, in _get_term_from_source
ValueError: value or token must be provided (only one of those)

This happens because plone.app.z3cform.converters mishandles the passed value (None, ) - it should return self.field.missing_value

I have a hunch that the passed value (from where?) used to be None and has been wrongfully cast into a tuple during the upgrade to Python 3. In fact, I received exactly that advice on an unrelated issue which happens because filter() now returns an iterator. Maybe someone more experienced than me could take a look?

Furthermore, after finding that ++widget++form.widgets.IDublinCore.creators/@@getSource returned Vocabulary lookup not allowed, I spotted the recent addition of a permission 'plone.app.multilingual.RootCatalog': 'View' in plone.app.content.vocabulary. For sh*ts and giggles, I endeavoured to add 'plone.app.vocabularies.Principals': 'Modify portal content' below it.

Now ++widget++form.widgets.IDublinCore.creators/@@getSource returns

  Module ZPublisher.WSGIPublisher, line 155, in transaction_pubevents
  Module ZPublisher.WSGIPublisher, line 337, in publish_module
  Module ZPublisher.WSGIPublisher, line 255, in publish
  Module ZPublisher.mapply, line 85, in mapply
  Module ZPublisher.WSGIPublisher, line 61, in call_object
  Module plone.app.content.browser.vocabulary, line 153, in __call__
  Module plone.app.content.browser.vocabulary, line 386, in get_vocabulary
AttributeError: 'TextLine' object has no attribute 'vocabulary'

So adding the permission was not fully correct. However: I now found my field to be able to select a related object. (!)

I am in over my head, but maybe on to something. Help please?

-Norbert

1 Like

Did you manage to solve this?

I worked around the error by monkey patching toWidgetValue in plone.app.z3cform.converters.AjaxSelectWidgetConverter But it should really be fixed where the (None, ) value is generated. Maybe @cekk has a better suggestion?

I proposed a PR for this, linked to your issue.

1 Like