2012-07-31 47 views
1

我有一个定制产品,其中有许多敏捷类型,其中有几个被建立处理程序用来创建网站结构。此作品,未经测试之外的任何问题,但测试中它一直未能:对测试过程中敏捷类型的ComponentLookupError

Traceback (most recent call last): 
    [snip] 
    File "/opt/ctcc_plone/src/ctcc.model/ctcc/model/setuphandlers.py", line 52, in setupStructure 
    random = createSiteFolder(portal, 'ctcc.model.servicefolder', 'Randomisation', 'random') 
    File "/opt/ctcc_plone/src/ctcc.model/ctcc/model/setuphandlers.py", line 35, in createSiteFolder 
    return createContentInContainer(context, type, title=title, id=id) 
    File "/opt/ctcc_plone/eggs/plone.dexterity-1.1-py2.7.egg/plone/dexterity/utils.py", line 166, in createContentInContainer 
    content = createContent(portal_type, **kw) 
    File "/opt/ctcc_plone/eggs/plone.dexterity-1.1-py2.7.egg/plone/dexterity/utils.py", line 112, in createContent 
    fti = getUtility(IDexterityFTI, name=portal_type) 
    File "/opt/ctcc_plone/eggs/zope.component-3.9.5-py2.7.egg/zope/component/_api.py", line 169, in getUtility 
    raise ComponentLookupError(interface, name) 
ComponentLookupError: (<InterfaceClass plone.dexterity.interfaces.IDexterityFTI>, 'ctcc.model.servicefolder') 

我保证包的配置文件在安装过程中输入:

class CTCCModelSandboxLayer(PloneSandboxLayer): 
    defaultBases = (PLONE_FIXTURE,) 

    def setUpZope(self, app, configurationContext): 
     import ctcc.model 
     self.loadZCML(package=ctcc.model) 

    def setUpPloneSite(self, portal): 
     self.applyProfile(portal, 'ctcc.model:default') 

虽然他们列为安装要求在包的设置中,我还尝试了plone.app.dexterity以及quickInstallProduct上的明确applyProfile,但由于某种原因,敏捷FTI在被调用时似乎没有注册。

我使用的Plone 4.1,敏捷1.1和4.2 plone.app.testing

+0

_Cannot_获取语法突出显示以处理代码段,对不起。 – 2012-07-31 06:16:33

+0

修正了对于亚,请参阅[我如何格式化我的代码块?](http://meta.stackexchange.com/q/22186) – 2012-07-31 09:27:23

+0

啊,我使用的是标签而不是lang引用,欢呼声。 – 2012-07-31 09:43:05

回答

1

正如米克的建议,我感动从产品的ZCML和成GenericSetup import_steps.xml代替setuphandler配置,允许明确被指定的typeinfo依赖性:

<?xml version="1.0"?> 
<import-steps> 
    <import-step 
     id="ctcc-setup" 
     title="Additional CTCC setup" 
     handler="ctcc.model.setuphandlers.setupVarious" 
     version="20120731" 
    > 
     <dependency step="typeinfo" /> 
    </import-step> 
</import-steps> 

测试现在运行,而不是在applyProfile阶段失败,和网站结构的测试表明它正在建立符合市场预期。

再次感谢!