ComponentLookupError:(<interfaceclass zc.relation.interfaces.icatalog =“”>,'')带有敏捷性引用</interfaceclass>

时间:2013-07-12 16:00:29

标签: reference plone dexterity

以下是我正在处理的灵巧内容类型的片段。有两种内容类型,即程序和项目。应该可以将项目与程序相关联(我在下面将其定义为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,
    )

上面的定义导致编辑视图看起来像这样。当我尝试添加相关项目时,它会抛出错误。

enter image description here

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

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>, '')

1 个答案:

答案 0 :(得分:3)

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