1
我正在關注操作敏捷內容對象的a tutorial。它解釋瞭如何創建對象。嘗試創建新的敏捷對象時ComponentLookupError
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')
內容類型'degu.Product'已列出,但是我得到時同樣的錯誤試圖使用它。另外,當使用'bin/instance debug'時,context沒有定義,所以我使用app.Plone來獲得類型。 – 2013-03-03 12:41:09
@DanielHernández:啊,使用'bin/instance debug'不會設置本地組件管理器。這是一個*不同的問題。 – 2013-03-03 12:41:58
我有同樣的問題惠特'bin /實例運行'。 – 2013-03-03 12:58:35