我想注册一个标记界面,以便将其添加到ZMI中的对象。我的产品configure.zcml
包含:
<interface interface=".interfaces.IMarkerInterface" />
,重新安装后,界面会显示在可用界面列表中。但是,如果我尝试将其添加到ZMI中的对象,我会得到ComponentLookupError
。有什么遗漏?
答案 0 :(得分:4)
它对我有用。
我在Plone 4.0.3中进行了测试
使用贴纸创建了一个包:
paster create -t plone bogus.interface
使用这个interfaces.py文件:
from zope.interface import Interface
class IBogusInterface(Interface):
""" Marker bogus interface
"""
这个configure.zcml文件:
<configure
xmlns="http://namespaces.zope.org/zope"
xmlns:five="http://namespaces.zope.org/five"
xmlns:i18n="http://namespaces.zope.org/i18n"
i18n_domain="bogus.interface">
<five:registerPackage package="." initialize=".initialize" />
<!-- -*- extra stuff goes here -*- -->
<interface interface=".interfaces.IBogusInterface" />
</configure>
你确定你没有遗漏任何东西吗?
答案 1 :(得分:3)
另请注意,显然,标记接口必须为空。他们不能包含属性或方法 - 如果他们这样做,他们就不会出现在ZMI中。