我想注册一个标记接口,以便可以将其添加到 ZMI 中的对象中。我的产品configure.zcml包含:
<interface interface=".interfaces.IMarkerInterface" />
并且,重新安装后,该接口显示在可用接口列表中。但是如果我尝试将它添加到 ZMI 中的对象中,我会得到一个ComponentLookupError. 少了什么东西?
它对我来说很好。
我在 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>
你确定你没有遗漏任何东西吗?
另请注意,显然,标记接口必须为空。它们不能包含属性或方法——如果包含,它们将不会出现在 ZMI 中。