如何让 "classic portlet" 显示在 Page 和 NewsItem 默认视图中?
How can I do for "classic portlet" be displayed in Page and NewsItem default views?
我使用 @@manage-portlets
将 "classic portlet" 与文件夹相关联,并且我希望该文件夹下的所有 NewsItem 和 Pages 项目也将显示此 portlet。但是我收到一个错误 "There was an error while rendering the portlet." 和以下追溯:
2015-06-26 13:52:35 ERROR Zope.SiteErrorLog 1435337555.110.623795385389 http://localhost:8080/institucional/datasenado/research/a-test-research-newitem/newsitem_view
Traceback (innermost last):
Module plone.app.portlets.manager, line 61, in safe_render
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
- Warning: Macro expansion failed
- Warning: <type 'exceptions.NameError'>: name 'path_expression' is not defined
Module zope.tal.talinterpreter, line 271, in __call__
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 852, in do_condition
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 867, in do_useMacro
Module zope.tales.tales, line 696, in evaluate
- URL: /plone4/buildout-cache/eggs/plone.app.portlets-2.1.5-py2.6.egg/plone/app/portlets/portlets/classic.pt
- Line 6, Column 4
- Expression: <PythonExpr (path(path_expression))>
- Names:
{'args': (),
'container': <ATNewsItem at /institucional/datasenado/research/a-test-research-newitem>,
'context': <ATNewsItem at /institucional/datasenado/research/a-test-research-newitem>,
'default': <object object at 0xb77147d0>,
'here': <ATNewsItem at /institucional/datasenado/research/a-test-research-newitem>,
'loop': {},
'nothing': None,
'options': {},
'repeat': <Products.PageTemplates.Expressions.SafeMapping object at 0xccffaa4>,
'request': <HTTPRequest, URL=http://localhost:8080/institucional/datasenado/research/a-test-research-newitem/newsitem_view>,
'root': <Application at >,
'template': <Products.Five.browser.pagetemplatefile.ViewPageTemplateFile object at 0xdc7a4cc>,
'traverse_subpath': [],
'user': <PropertiedUser 'admin'>,
'view': <plone.app.portlets.portlets.classic.Renderer object at 0xe06794c>,
'views': <Products.Five.browser.pagetemplatefile.ViewMapper object at 0xe0673cc>}
Module zope.tales.pythonexpr, line 59, in __call__
- __traceback_info__: (path(path_expression))
Module <string>, line 1, in <module>
Module zope.tales.pythonexpr, line 77, in __call__
Module zope.tales.expressions, line 217, in __call__
Module Products.PageTemplates.Expressions, line 147, in _eval
Module zope.tales.expressions, line 124, in _eval
Module Products.PageTemplates.Expressions, line 94, in trustedBoboAwareZopeTraverse
Module OFS.Traversable, line 283, in unrestrictedTraverse
- __traceback_info__: ([], 'menudatasenado')
AttributeError: menudatasenado
那么,如何才能让 "classic portlet" 显示在 Page 和 NewsItem 默认视图中?
您的理解是正确的:如果您在文件夹上设置 portlet,它也会显示在该文件夹或其任何子文件夹中的任何项目上(除非您明确阻止该 portlet)。
在您描述的情况下,portlet 呈现中存在错误:您需要了解为什么 menudatasenado
得到 AttributeError
。
没有 portlet 代码很难帮到你。您似乎引用了无法从其他内容项访问的特定内容项 (menudatasenado
)。
我使用 @@manage-portlets
将 "classic portlet" 与文件夹相关联,并且我希望该文件夹下的所有 NewsItem 和 Pages 项目也将显示此 portlet。但是我收到一个错误 "There was an error while rendering the portlet." 和以下追溯:
2015-06-26 13:52:35 ERROR Zope.SiteErrorLog 1435337555.110.623795385389 http://localhost:8080/institucional/datasenado/research/a-test-research-newitem/newsitem_view
Traceback (innermost last):
Module plone.app.portlets.manager, line 61, in safe_render
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
- Warning: Macro expansion failed
- Warning: <type 'exceptions.NameError'>: name 'path_expression' is not defined
Module zope.tal.talinterpreter, line 271, in __call__
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 852, in do_condition
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 867, in do_useMacro
Module zope.tales.tales, line 696, in evaluate
- URL: /plone4/buildout-cache/eggs/plone.app.portlets-2.1.5-py2.6.egg/plone/app/portlets/portlets/classic.pt
- Line 6, Column 4
- Expression: <PythonExpr (path(path_expression))>
- Names:
{'args': (),
'container': <ATNewsItem at /institucional/datasenado/research/a-test-research-newitem>,
'context': <ATNewsItem at /institucional/datasenado/research/a-test-research-newitem>,
'default': <object object at 0xb77147d0>,
'here': <ATNewsItem at /institucional/datasenado/research/a-test-research-newitem>,
'loop': {},
'nothing': None,
'options': {},
'repeat': <Products.PageTemplates.Expressions.SafeMapping object at 0xccffaa4>,
'request': <HTTPRequest, URL=http://localhost:8080/institucional/datasenado/research/a-test-research-newitem/newsitem_view>,
'root': <Application at >,
'template': <Products.Five.browser.pagetemplatefile.ViewPageTemplateFile object at 0xdc7a4cc>,
'traverse_subpath': [],
'user': <PropertiedUser 'admin'>,
'view': <plone.app.portlets.portlets.classic.Renderer object at 0xe06794c>,
'views': <Products.Five.browser.pagetemplatefile.ViewMapper object at 0xe0673cc>}
Module zope.tales.pythonexpr, line 59, in __call__
- __traceback_info__: (path(path_expression))
Module <string>, line 1, in <module>
Module zope.tales.pythonexpr, line 77, in __call__
Module zope.tales.expressions, line 217, in __call__
Module Products.PageTemplates.Expressions, line 147, in _eval
Module zope.tales.expressions, line 124, in _eval
Module Products.PageTemplates.Expressions, line 94, in trustedBoboAwareZopeTraverse
Module OFS.Traversable, line 283, in unrestrictedTraverse
- __traceback_info__: ([], 'menudatasenado')
AttributeError: menudatasenado
那么,如何才能让 "classic portlet" 显示在 Page 和 NewsItem 默认视图中?
您的理解是正确的:如果您在文件夹上设置 portlet,它也会显示在该文件夹或其任何子文件夹中的任何项目上(除非您明确阻止该 portlet)。
在您描述的情况下,portlet 呈现中存在错误:您需要了解为什么 menudatasenado
得到 AttributeError
。
没有 portlet 代码很难帮到你。您似乎引用了无法从其他内容项访问的特定内容项 (menudatasenado
)。