带有敏捷参考的ComponentLookupError:(< InterfaceClass zc.relation.interfaces.ICatalog&gt ;,'&

编程入门 行业动态 更新时间:2024-10-27 16:30:37
本文介绍了带有敏捷参考的ComponentLookupError:(< InterfaceClass zc.relation.interfaces.ICatalog&gt ;,'')的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

以下是我正在研究的敏捷性内容类型的摘录.有两种内容类型,程序和项目.应该可以将项目与程序相关联(我在下面将其定义为RelationChoice).

The following is a snippet from a dexterity content type which I'm working on. There are two content types, Programmes and Projects. It should be possible to associate a Project with a Programme (I've defined that below as a 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 definition above results in an editing view that looks like this. When I try to add a related project it throws an error.

这是我尝试添加相关项目时得到的追溯:

Here's the traceback I get when I try to add a related 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 zopeponent.event, line 24, in dispatch Module zopeponent._api, line 136, in subscribers Module zopeponent.registry, line 321, in subscribers Module zope.interface.adapter, line 585, in subscribers Module zopeponent.event, line 32, in objectEventNotify Module zopeponent._api, line 136, in subscribers Module zopeponent.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 zopeponent.event, line 24, in dispatch Module zopeponent._api, line 136, in subscribers Module zopeponent.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 zopeponent._api, line 169, in getUtility ComponentLookupError: (<InterfaceClass zc.relation.interfaces.ICatalog>, '')

推荐答案

您需要在Addons控制面板中激活"Relation Field"(plone.app.relationfield)以安装关系目录.

You need to activate "Relation Field" (plone.app.relationfield) in the Addons control panel to install the relation catalog.

更多推荐

带有敏捷参考的ComponentLookupError:(&lt; InterfaceClass zc.relation.interfaces.ICat

本文发布于:2023-09-12 00:24:58,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1466867.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:敏捷   lt   InterfaceClass   amp   zc

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!