我正在尝试按照Plone.org和WebLion的教程为我的主题页脚创建一个自定义 portlet 管理器。
我想要做的是在我的主题中添加一个 viewlet 管理器和一个应该作为 portlet 管理器运行的 viewlet。
当viewlet 的模板中有一个TAL 块时,我得到了一个ContentProviderLookupError
应该作为我的portlet 管理器工作的viewlet。viewletmanager 和 viewlet 模板在页面上正确显示,据我所知,如果我省略了 TAL 块。
主题是使用此处的 sane_plone_addon_template 完成的
我真的看不出我在这里做错了什么,并且在 Plone 方面成为一个完整的菜鸟真的没有帮助,所以任何能推动我朝着正确方向前进的想法都会非常感激。
这是我的configure.zcml
<browser:viewletManager
name="footerPortlets1"
provides=".interfaces.IspFooterPortletsViewletManager"
class="plone.app.viewletmanager.manager.OrderedViewletManager"
layer=".interfaces.IThemeSpecific"
permission="zope2.View"
/>
<browser:viewlet
name="footerPortlets"
manager=".interfaces.IspFooterPortletsViewletManager"
template="templates/footerPortlets.pt"
layer=".interfaces.IThemeSpecific"
permission="zope2.View"
/>
配置文件/默认/中的portlets.xml
<?xml version="1.0"?>
<portlets
xmlns:i18n="http://xml.zope.org/namespaces/i18n"
i18n:domain="plone">
<portletmanager
name="footerPortlets"
type="mytheme.interfaces.IFooterPortlets"
/>
</portlets>
接口.py
from plone.portlets.interfaces import IPortletManager
from plone.app.portlets.interfaces import IColumn
class IFooterPortlets(IPortletManager, IColumn):
""""""
这是 viewlet 模板footerPortlets.pt
<div id = "footer-portlets-container">
test
<tal:block replace="structure provider:footerPortlets" /> <!-- This part fails -->
</div>
这是错误的堆栈跟踪:
Traceback (innermost last):
Module ZPublisher.Publish, line 126, in publish
Module ZPublisher.mapply, line 77, in mapply
Module ZPublisher.Publish, line 46, in call_object
Module Shared.DC.Scripts.Bindings, line 322, in __call__
Module Shared.DC.Scripts.Bindings, line 359, in _bindAndExec
Module Products.CMFCore.FSPageTemplate, line 237, in _exec
Module Products.CMFCore.FSPageTemplate, line 177, in pt_render
Module Products.PageTemplates.PageTemplate, line 79, in pt_render
Module zope.pagetemplate.pagetemplate, line 113, in pt_render
Module zope.tal.talinterpreter, line 271, in __call__
Module zope.tal.talinterpreter, line 343, in interpret
Module zope.tal.talinterpreter, line 888, in do_useMacro
Module zope.tal.talinterpreter, line 343, in interpret
Module zope.tal.talinterpreter, line 533, in do_optTag_tal
Module zope.tal.talinterpreter, line 518, in do_optTag
Module zope.tal.talinterpreter, line 513, in no_tag
Module zope.tal.talinterpreter, line 343, in interpret
Module zope.tal.talinterpreter, line 531, in do_optTag_tal
Module zope.tal.talinterpreter, line 513, in no_tag
Module zope.tal.talinterpreter, line 343, in interpret
Module zope.tal.talinterpreter, line 742, in do_insertStructure_tal
Module Products.PageTemplates.Expressions, line 218, in evaluateStructure
Module zope.tales.tales, line 696, in evaluate
- URL: file:/home/user/Plone/zinstance/src/santasport/santasport/templates/plonetheme.sunburst.skins.sunburst_templates.main_template.pt
- Line 181, Column 3
- Expression: <StringExpr u'footerPortlets1'>
- Names:
{'container': <ATDocument at /Santasport/front-page>,
'context': <ATDocument at /Santasport/front-page>,
'default': <object object at 0xb77bc7d0>,
'here': <ATDocument at /Santasport/front-page>,
'loop': {},
'nothing': None,
'options': {'args': ()},
'repeat': <Products.PageTemplates.Expressions.SafeMapping object at 0xb4a8e34c>,
'request': <HTTPRequest, URL=http://127.0.0.1:8080/Santasport/front-page/document_view>,
'root': <Application at >,
'template': <FSPageTemplate at /Santasport/front-page/document_view>,
'traverse_subpath': [],
'user': <PropertiedUser 'admin'>}
Module zope.contentprovider.tales, line 80, in __call__
Module plone.app.viewletmanager.manager, line 154, in render
Module plone.app.viewletmanager.manager, line 85, in render
Module zope.browserpage.simpleviewclass, line 44, in __call__
Module Products.Five.browser.pagetemplatefile, line 125, in __call__
Module Products.Five.browser.pagetemplatefile, line 59, in __call__
Module zope.pagetemplate.pagetemplate, line 113, in pt_render
Module zope.tal.talinterpreter, line 271, in __call__
Module zope.tal.talinterpreter, line 343, in interpret
Module zope.tal.talinterpreter, line 531, in do_optTag_tal
Module zope.tal.talinterpreter, line 513, in no_tag
Module zope.tal.talinterpreter, line 343, in interpret
Module zope.tal.talinterpreter, line 742, in do_insertStructure_tal
Module Products.PageTemplates.Expressions, line 218, in evaluateStructure
Module zope.tales.tales, line 696, in evaluate
- URL: /home/user/Plone/zinstance/src/santasport/santasport/templates/footerPortlets.pt
- Line 3, Column 1
- Expression: <StringExpr u'footerportlets'>
- Names:
{'args': (),
'container': <ATDocument at /my-theme/front-page>,
'context': <ATDocument at /my-theme/front-page>,
'default': <object object at 0xb77bc7d0>,
'here': <ATDocument at /my-theme/front-page>,
'loop': {},
'nothing': None,
'options': {},
'repeat': <Products.PageTemplates.Expressions.SafeMapping object at 0xb4a7dcfc>,
'request': <HTTPRequest, URL=http://127.0.0.1:8080/my-theme/front-page/document_view>,
'root': <Application at >,
'template': <Products.Five.browser.pagetemplatefile.ViewPageTemplateFile object at 0xb5e055ac>,
'traverse_subpath': [],
'user': <PropertiedUser 'admin'>,
'view': <Products.Five.viewlet.viewlet.SimpleViewletClass from /home/user/Plone/zinstance/src/my-theme/my-theme/templates/footerPortlets.pt object at 0xb4a3f52c>,
'views': <Products.Five.browser.pagetemplatefile.ViewMapper object at 0xb5e2cdac>}
Module zope.contentprovider.tales, line 66, in __call__
ContentProviderLookupError: footerPortlets
编辑:
我通过将我的 viewlet 添加到 viewlets.xml 并将其添加到我的配置文件文件夹中(正如其中一个教程所说的 FML),使这段代码工作了一些,但我并没有真正对其进行进一步测试,而是查看了 Mikko 的教程开箱即用地为我工作非常好。
Ps:任何想法如何标记这个问题?