gpt4 book ai didi

python - Plone : unbound prefix in configure. zcml

转载 作者:行者123 更新时间:2023-11-28 19:54:38 25 4
gpt4 key购买 nike

我正在为我的 Plone 站点开发一个新的附加组件,结果它显示我的错误

configure.zcml : unbound prefix.

我在这里写我的 zcml 代码:

    <configure
xmlns="http://namespaces.zope.org/zope"
xmlns:five="http://namespaces.zope.org/five"
xmlns:i18n="http://namespaces.zope.org/i18n"
i18n_domain="customer.reports">

<five:registerPackage package="." initialize=".initialize" />

<include package="plone.resource" file="meta.zcml"/>
<plone:static
directory="templates"
type="reports"
name="customer"
/>
</configure>

未绑定(bind)前缀错误如下。

File "/Plone/Python-2.7/lib/python2.7/xml/sax/handler.py", line 38, in fatalError raise exception zope.configuration.xmlconfig.ZopeXMLConfigurationError: File "/Plone/zinstance/parts/instance/etc/site.zcml", line 16.2-16.23 ZopeXMLConfigurationError: File "/Plone/buildout-cache/eggs/Products.CMFPlone-4.3-py2.7.egg/Products/CMFPlone/configure.zcml", line 98.4-102.10 ZopeSAXParseException: File "/Plone/zinstance/src/customer.reports/customer/reports/configure.zcml", line 13.2, unbound prefix

最佳答案

此错误表明您在 configure.zcml 的顶部缺少命名空间声明。尝试在配置标签中包含以下内容之一:

 xmlns:plone="http://namespaces.plone.org/plone"

因为我在我的代码中添加了上面一行来修复未绑定(bind)错误,在此之前我使用 plone 注册我的附加组件但没有声明正确的 namespace ,即 zcml 文件的 namespace 声明 block 中的 plone

<configure
xmlns="http://namespaces.zope.org/zope"
xmlns:five="http://namespaces.zope.org/five"
xmlns:i18n="http://namespaces.zope.org/i18n"
xmlns:plone="http://namespaces.plone.org/plone"
i18n_domain="customer.reports">

<five:registerPackage package="." initialize=".initialize" />

<!-- -*- extra stuff goes here -*- -->

<include package="plone.resource" file="meta.zcml"/>
<plone:static
directory="templates"
type="reports"
name="customer"
/>
</configure>

关于python - Plone : unbound prefix in configure. zcml,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35263168/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com