Leonardo Andrade
Leonardo Andrade

Reputation: 2628

How can I do for "classic portlet" be displayed in Page and NewsItem default views?

I associated a "classic portlet" with a folder using @@manage-portlets, and I expected that all NewsItem and Pages items below this folder would be display this portlet as well. But I received an error "There was an error while rendering the portlet." and this following traceback:

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

So, how can I do for "classic portlet" be displayed in Page and NewsItem default views?

Upvotes: 0

Views: 80

Answers (1)

Godefroid Chapelle
Godefroid Chapelle

Reputation: 690

Your understanding is correct: if you setup a portlet on a folder, it will be also displayed on any items that are in that folder or any of its subfolders (unless you explicitely block the portlet).

In the case you describe, there is an error in the portlet rendering: you need to understand why you get an AttributeError for menudatasenado.

It is hard to help you more without the portlet code. It seems you reference a specific content item (menudatasenado) which is not accessible from other content items.

Upvotes: 3

Related Questions