简体   繁体   English

在基于 z3c.form 的表单 updateWidgets() 上引发 ComponentLookupError

[英]ComponentLookupError raised on z3c.form based form updateWidgets()

I'm having this issue while running tests only after I removed the <includeDependencies package="." />仅在删除<includeDependencies package="." />后,我才在运行测试时遇到此问题<includeDependencies package="." /> <includeDependencies package="." /> directive from my configure.zcml file: <includeDependencies package="." />指令来自我的configure.zcml文件:

Error in test test_get_load_action (sc.embedder.tests.test_content.MultimediaTestCase)
Traceback (most recent call last):
  File "/home/hvelarde/collective/buildout.python/parts/opt/lib/python2.7/unittest/case.py", line 329, in run
    testMethod()
  File "/home/hvelarde/collective/sc.embedder/src/sc/embedder/tests/test_content.py", line 135, in test_get_load_action
    edit_form.update()
  File "/home/hvelarde/.buildout/eggs/plone.dexterity-1.1.2-py2.7.egg/plone/dexterity/browser/edit.py", line 52, in update
    super(DefaultEditForm, self).update()
  File "/home/hvelarde/.buildout/eggs/plone.z3cform-0.7.8-py2.7.egg/plone/z3cform/fieldsets/extensible.py", line 59, in update
    super(ExtensibleForm, self).update()
  File "/home/hvelarde/.buildout/eggs/plone.z3cform-0.7.8-py2.7.egg/plone/z3cform/patch.py", line 30, in GroupForm_update
    _original_GroupForm_update(self)
  File "/home/hvelarde/.buildout/eggs/z3c.form-2.5.1-py2.7.egg/z3c/form/group.py", line 125, in update
    self.updateWidgets()
  File "/home/hvelarde/.buildout/eggs/z3c.form-2.5.1-py2.7.egg/z3c/form/form.py", line 129, in updateWidgets
    (self, self.request, self.getContent()), interfaces.IWidgets)
  File "/home/hvelarde/.buildout/eggs/zope.component-3.9.5-py2.7.egg/zope/component/_api.py", line 109, in getMultiAdapter
    raise ComponentLookupError(objects, interface, name)
ComponentLookupError: ((<Products.Five.metaclass.EditForm object at 0x7f5262a3f490>, <HTTPRequest, URL=http://nohost>, <Embedder at /plone/test-folder/multimedia>), <InterfaceClass z3c.form.interfaces.IWidgets>, u'')

Same versions where working before;以前工作的相同版本; current configure.zcml now includes the following:当前的configure.zcml现在包括以下内容:

<include package="Products.CMFCore" file="permissions.zcml" />
<include package="plone.app.dexterity" />
<include package="plone.app.dexterity" file="meta.zcml" />
<include package="five.grok" />

According to the documentation this is a known issue due to a bad migration, but this can't the case. 根据文档,这是由于迁移不良导致的已知问题,但事实并非如此。

I'm testing under Plone 4.2.6.我正在 Plone 4.2.6 下进行测试。 Same code works and tests pass under Plone 4.3 as you can see in the CI builds .正如您在 CI 构建中看到的那样,相同的代码在 Plone 4.3 下工作并通过测试。

Seems I was missing a package on the configure.zcml declaration;似乎我在 configure.zcml 声明中缺少一个包; now it looks like this:现在它看起来像这样:

<include package="Products.CMFCore" file="permissions.zcml" />
<include package="plone.app.dexterity" />
<include package="plone.app.dexterity" file="meta.zcml" />
<include package="collective.dexteritytextindexer" />

and now is working: https://travis-ci.org/simplesconsultoria/sc.embedder/builds/126432050现在正在工作: https : //travis-ci.org/simplesconsultoria/sc.embedder/builds/126432050

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM