ComponentLookupError: (<InterfaceClass zc.relation.interfaces.ICatalog>, '') with dexterity recommendations

The following is a snippet from the type of agility content I'm working on. There are two types of content: Programs and Projects. It should be possible to link the project with the program (I defined it below as RelationChoice).

from five import grok from plone.directives import dexterity, form from zope import schema from zope.schema.interfaces import IContextSourceBinder from zope.schema.vocabulary import SimpleVocabulary, SimpleTerm from zope.interface import invariant, Invalid from z3c.form import group, field from plone.namedfile.interfaces import IImageScaleTraversable from plone.namedfile.field import NamedImage, NamedFile from plone.namedfile.field import NamedBlobImage, NamedBlobFile from plone.app.textfield import RichText from z3c.relationfield.schema import RelationList, RelationChoice from plone.formwidget.contenttree import ObjPathSourceBinder from alteroo.programmeshowcase import MessageFactory as _ from alteroo.programmeshowcase.project import IProject # Interface class; used to define content-type schema. class IBaseProgramme(form.Schema, IImageScaleTraversable): """ Programme """ # If you want a schema-defined interface, delete the form.model # line below and delete the matching file in the models sub-directory. # If you want a model-based interface, edit # models/progamme.xml to define the content type # and add directives here as necessary. form.model("models/programme.xml") class IProgamme(IBaseProgramme): """A conference program. Programs can contain Sessions. """ project = RelationChoice( title=_(u"Project"), source=ObjPathSourceBinder(object_provides=IProject.__identifier__), required=False, ) 

The above definition leads to an editing view that looks like this. When I try to add a linked project, it throws an error.

enter image description here

Here is the trace I get when I try to add a linked project:

 Traceback (innermost last): Module ZPublisher.Publish, line 126, in publish Module ZPublisher.mapply, line 77, in mapply Module ZPublisher.Publish, line 46, in call_object Module plone.z3cform.layout, line 66, in __call__ Module plone.z3cform.layout, line 50, in update Module plone.dexterity.browser.add, line 112, in update Module plone.z3cform.fieldsets.extensible, line 59, in update Module plone.z3cform.patch, line 30, in GroupForm_update Module z3c.form.group, line 141, in update Module plone.app.z3cform.csrf, line 21, in execute Module z3c.form.action, line 98, in execute Module z3c.form.button, line 315, in __call__ Module z3c.form.button, line 170, in __call__ Module plone.dexterity.browser.add, line 99, in handleAdd Module z3c.form.form, line 247, in createAndAdd Module plone.dexterity.browser.add, line 78, in add Module plone.dexterity.utils, line 167, in addContentToContainer Module OFS.ObjectManager, line 358, in _setObject Module zope.event, line 31, in notify Module zope.component.event, line 24, in dispatch Module zope.component._api, line 136, in subscribers Module zope.component.registry, line 321, in subscribers Module zope.interface.adapter, line 585, in subscribers Module zope.component.event, line 32, in objectEventNotify Module zope.component._api, line 136, in subscribers Module zope.component.registry, line 321, in subscribers Module zope.interface.adapter, line 585, in subscribers Module five.intid.intid, line 101, in addIntIdSubscriber Module zope.event, line 31, in notify Module zope.component.event, line 24, in dispatch Module zope.component._api, line 136, in subscribers Module zope.component.registry, line 321, in subscribers Module zope.interface.adapter, line 585, in subscribers Module z3c.relationfield.event, line 39, in addRelationsEventOnly Module z3c.relationfield.event, line 28, in addRelations Module z3c.relationfield.event, line 143, in _setRelation Module zope.component._api, line 169, in getUtility ComponentLookupError: (<InterfaceClass zc.relation.interfaces.ICatalog>, '') 
+2
source share
1 answer

To set up a relationship directory, you need to activate the Relationship Field (plone.app.relationfield) in the Addons control panel.

+3
source

Source: https://habr.com/ru/post/1490523/


All Articles