创建Plone 4自定义portlet管理器

创建Plone 4自定义portlet管理器,plone,Plone,我正试图通过以下来自和的教程为主题的页脚创建一个自定义portlet管理器 我试图做的是在我的主题中添加一个viewlet管理器和一个viewlet,它们应该起到portlet管理器的作用 当viewlet的模板中有一个TAL块时,我将为该viewlet获取一个ContentProviderLookupError,该viewlet应该用作我的portlet管理器。如果省略了TAL块,就我所知,viewletmanager和viewlet模板在页面上显示正确 主题是使用来自的sane_plone_

我正试图通过以下来自和的教程为主题的页脚创建一个自定义portlet管理器

我试图做的是在我的主题中添加一个viewlet管理器和一个viewlet,它们应该起到portlet管理器的作用

当viewlet的模板中有一个TAL块时,我将为该viewlet获取一个
ContentProviderLookupError
,该viewlet应该用作我的portlet管理器。如果省略了TAL块,就我所知,viewletmanager和viewlet模板在页面上显示正确

主题是使用来自的sane_plone_addon_模板完成的

我真的看不出我在这里做错了什么,当涉及到Plone的时候,做一个完全的傻瓜真的没有帮助,所以任何能把我推向正确方向的想法都会非常感激

这是我的配置.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" 
    /> 
这是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
回溯(最里面的最后一个):
发布中的模块ZPublisher.Publish,第126行
模块ZPublisher.mapply,第77行,在mapply中
模块ZPublisher.Publish,第46行,在call_对象中
模块Shared.DC.Scripts.Bindings,第322行,在调用中__
模块Shared.DC.Scripts.Bindings,第359行,在_bindAndExec中
模块Products.CMFCore.FSPageTemplate,第237行,in_exec
模块Products.CMFCore.FSPageTemplate,第177行,在pt_渲染中
模块Products.PageTemplates.PageTemplate,第79行,在pt_render中
模块zope.pagetemplate.pagetemplate,第113行,在pt_渲染中
模块zope.tal.t interpreter,第271行,输入调用__
模块zope.tal.t解释程序第343行
do_useMacro中的模块zope.tal.tInterpreter,第888行
模块zope.tal.t解释程序第343行
do_optTag_tal中模块zope.tal.tInterpreter,第533行
do_optTag中第518行模块zope.tal.tInterpreter
模块zope.tal.tInterpreter,第513行,无标签
模块zope.tal.t解释程序第343行
do_optTag_tal中模块zope.tal.tInterpreter,第531行
模块zope.tal.tInterpreter,第513行,无标签
模块zope.tal.t解释程序第343行
do_insertStructure_tal中模块zope.tal.tInterpreter,第742行
evaluateStructure中模块Products.PageTemplates.Expressions,第218行
模块zope.tales.tales,第696行,在评估中
-URL:file:/home/user/Plone/zinstance/src/santasport/santasport/templates/plonetheme.sunburst.skins.sunburst\u templates.main\u template.pt
-第181行第3栏
-表达方式:
-姓名:
{'container':,
“上下文”:,
“默认值”:,
“这里”:,
'循环':{},
“没有”:没有,
'options':{'args':()},
“重复”:,
“请求”:,
“根”:,
“模板”:,
“遍历子路径”:[],
“用户”:}
模块zope.contentprovider.tales,第80行,输入调用__
渲染中的模块plone.app.viewletmanager.manager,第154行
渲染中的模块plone.app.viewletmanager.manager,第85行
模块zope.browserpage.simpleviewclass,第44行,在调用中__
模块Products.Five.browser.pagetemplatefile,第125行,在调用中__
模块Products.Five.browser.pagetemplatefile,第59行,在调用中__
模块zope.pagetemplate.pagetemplate,第113行,在pt_渲染中
模块zope.tal.t interpreter,第271行,输入调用__
模块zope.tal.t解释程序第343行
do_optTag_tal中模块zope.tal.tInterpreter,第531行
模块zope.tal.tInterpreter,第513行,无标签
模块zope.tal.t解释程序第343行
do_insertStructure_tal中模块zope.tal.tInterpreter,第742行
evaluateStructure中模块Products.PageTemplates.Expressions,第218行
模块zope.tales.tales,第696行,在评估中
-URL:/home/user/Plone/zinstance/src/santasport/santasport/templates/footerPortlets.pt
-第3行第1列
-表达方式:
-姓名:
{'args':(),
“容器”:,
“上下文”:,
“默认值”:,
“这里”:,
'循环':{},
“没有”:没有,
“选项”:{},
“重复”:,
“请求”:,
“根”:,
“模板”:,
“遍历子路径”:[],
“用户”:,
“视图”:,
“视图”:
模块zope.contentprovider.tales,第66行,输入调用__
ContentProviderLookupError:FooterPortlet
编辑:

通过将我的viewlet添加到viewlets.xml并将其添加到我的profiles文件夹(正如其中一个教程所说的FML),我在某种程度上实现了这段代码,但我并没有进一步测试它,而是查看了Mikko的教程,该教程对我非常有用


Ps:你知道如何标记这个问题吗?

你需要导入
portlets.xml
配置

最直接的方法是通过ZMI中的
portal\u setup
工具。在“导入”选项卡上(在选择概要文件或快照选择框中)找到您的产品名称,然后当页面重新加载(显示“产品概要文件名称”的可用导入步骤)时,您需要在列表中查找portlet导入步骤(“导入portlet管理器、类型、分配和黑名单”),勾选其框,然后点击底部的“导入所选步骤”按钮


WebLion教程模糊地记录了这一点,称之为“配置现已完成”。卸载您的主题,重新启动Zope并重新安装您的主题。“。Plone.org文档似乎完全忽略了它。

更多教程!很棒的教程,希望我早点找到它:D
<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