我正在关注有关操作灵巧内容对象的教程。它解释了如何创建对象。
from zope.component import createObject
context = createObject('example.type')
但我不知道该放什么example.type
。我尝试使用IProduct
,degu.product.IProduct
和degu.Product
. 但是它们都引发了 ComponentLookupError。
Traceback (most recent call last):
File "<console>", line 1, in <module>
File "/home/daniel/.buildout/eggs/zope.component-3.9.5-py2.6.egg/zope/component/_api.py", line 220, in createObject
return getUtility(IFactory, __factory_name, context)(*args, **kwargs)
File "/home/daniel/.buildout/eggs/zope.component-3.9.5-py2.6.egg/zope/component/_api.py", line 169, in getUtility
raise ComponentLookupError(interface, name)
ComponentLookupError: (<InterfaceClass zope.component.interfaces.IFactory>, 'degu.commerce.product.IProduct')