[Plone-IT] Aggiungere un portlet manager: errore

Simone Sacchi simone a cib.unibo.it
Lun 6 Ott 2008 13:10:39 UTC


Il Monday 06 October 2008 14:33:32 Fabrizio Reale ha scritto:
> > Effettivamente mi mostra <p></p>
> >
> > ... significa che il valore della variabile non è disponibile?
>
> Esatto, perchè è una viewlet e non un template classico.
> Riesci ad identificare un'altra condizione utile?
> Altrimenti devi scrivere una vista.

Mhh, difficile... per intenderci lo vorrei far apparire in tutti i folder di 
primo livello (quelli che vengono identificati come "sections"  e che di 
default comparirebbero nelle tab)

La soluzione ideale per me era poter implementare un portlet manager in una 
viewlet perchè era molto flessibile (potevo decidere dove volevo far 
apparire, in un portlet, la portzione di html che mi interessa), ma come vi 
dicevo seguendo tutti i tutorial ottenevo sempre lo stesso errore. (ve lo 
riallego in fondo alla mail insieme a tutto il codice che avevo usato)

In Plone 2.5 avevo implementato un slot nel template path_bar.pt che riempivo 
con una porzione html che era presente nel template 
folder_home3_summary_view.

In Plone 3.1 non sono riuscito a fare lo stesso procedimento perchè (sembra) 
che in una viewlet non posso implementare una macro, corretto?

Rimando alla vostra clemenza e a eventuali idee in proposito...

Simone

----------------------------------------------
In browser/interfaces.py i added:
------------
from plone.portlets.interfaces import IPortletManager

class IMyAboveContent(IPortletManager):
 """A description goes here    """
--------------

Here is the content of profiles/default/portlets.xml
-------------
<?xml version="1.0"?>
<portlets>
 <portletmanager
   name="my.searchengineportlets"
   type="Products.portaleBiblioteche.theme.browser.interfaces.IMyAboveContent"
 />
</portlets>
--------------

In browser/configure.zcml i created the viewlet that should contain the 
portlet manager:
-----------------------
<!-- Viewlet for the search engine portlet-->
<browser:viewlet
    name="portaleBiblioteche.search_engine"
    manager="plone.app.layout.viewlets.interfaces.IContentViews"
    layer=".interfaces.IThemeSpecific"
    class=".viewlets.SearchEngineViewlet"
    permission="zope2.View"
/>
-----------------------

Here is the class for the viewlet in browser/viewlets.py
--------------------
class SearchEngineViewlet(ViewletBase):
            render = ViewPageTemplateFile('templates/search_engine.pt')
-------------------

And finally the template for the viewlet browser/templates/search_engine.pt 
which contains:
-------------------
<tal:block replace="structure provider:my.searchengineportlets" />
-------------------

Everything is Ok until I add
<tal:block replace="structure provider:my.searchengineportlets" />
to the template...

-------------------------------------------------------------------------
Traceback
-----------------------------------------------------------------------
Traceback (innermost last):
  Module ZPublisher.Publish, line 119, in publish
  Module ZPublisher.mapply, line 88, in mapply
  Module ZPublisher.Publish, line 42, in call_object
  Module Shared.DC.Scripts.Bindings, line 313, in __call__
  Module Shared.DC.Scripts.Bindings, line 350, in _bindAndExec
  Module Products.CMFCore.FSPageTemplate, line 216, in _exec
  Module Products.CMFCore.FSPageTemplate, line 155, in pt_render
  Module Products.PageTemplates.PageTemplate, line 89, in pt_render
  Module zope.pagetemplate.pagetemplate, line 117, in pt_render
   - Warning: Macro expansion failed
   - Warning: exceptions.KeyError: 'fl_macro'
  Module zope.tal.talinterpreter, line 271, in __call__
  Module zope.tal.talinterpreter, line 346, in interpret
  Module zope.tal.talinterpreter, line 891, in do_useMacro
  Module zope.tal.talinterpreter, line 346, in interpret
  Module zope.tal.talinterpreter, line 536, in do_optTag_tal
  Module zope.tal.talinterpreter, line 521, in do_optTag
  Module zope.tal.talinterpreter, line 516, in no_tag
  Module zope.tal.talinterpreter, line 346, in interpret
  Module zope.tal.talinterpreter, line 957, in do_defineSlot
  Module zope.tal.talinterpreter, line 346, in interpret
  Module zope.tal.talinterpreter, line 536, in do_optTag_tal
  Module zope.tal.talinterpreter, line 521, in do_optTag
  Module zope.tal.talinterpreter, line 516, in no_tag
  Module zope.tal.talinterpreter, line 346, in interpret
  Module zope.tal.talinterpreter, line 861, in do_defineMacro
  Module zope.tal.talinterpreter, line 346, in interpret
  Module zope.tal.talinterpreter, line 534, in do_optTag_tal
  Module zope.tal.talinterpreter, line 516, in no_tag
  Module zope.tal.talinterpreter, line 346, in interpret
  Module zope.tal.talinterpreter, line 745, in do_insertStructure_tal
  Module Products.PageTemplates.Expressions, line 221, in evaluateStructure
  Module zope.tales.tales, line 696, in evaluate
   - URL: 
file:/portale/portale/sviluppo/software/plone-3.1.2/portale/parts/plone/CMFPlone/skins/plone_templates/main_template.pt
   - Line 99, Column 18
   - Expression: <StringExpr u'plone.contentviews'>
   - Names:
      {'container': <PloneSite at /cms>,
       'context': <ATTopic at /cms/portale/home>,
       'default': <object object at 0x1ab528>,
       'here': <ATTopic at /cms/portale/home>,
       'loop': {},
       'nothing': None,
       'options': {'args': ()},
       'repeat': <Products.PageTemplates.Expressions.SafeMapping object at 
0x67c4be8>,
       'request': <HTTPRequest, 
URL=http://www.biblioteche.unibo.it:15000/portale/home/folder_home3_summary_view>,
       'root': <Application at >,
       'template': <FSPageTemplate at /cms/folder_home3_summary_view used 
for /cms/portale/home>,
       'traverse_subpath': [],
       'user': <PloneUser 'simone'>}
  Module Products.Five.browser.providerexpression, line 37, in __call__
  Module plone.app.viewletmanager.manager, line 151, in render
  Module plone.app.viewletmanager.manager, line 80, in render
  Module Shared.DC.Scripts.Bindings, line 313, in __call__
  Module Shared.DC.Scripts.Bindings, line 350, in _bindAndExec
  Module Products.PageTemplates.PageTemplateFile, line 129, in _exec
  Module Products.PageTemplates.PageTemplate, line 89, in pt_render
  Module zope.pagetemplate.pagetemplate, line 117, in pt_render
  Module zope.tal.talinterpreter, line 271, in __call__
  Module zope.tal.talinterpreter, line 346, in interpret
  Module zope.tal.talinterpreter, line 534, in do_optTag_tal
  Module zope.tal.talinterpreter, line 516, in no_tag
  Module zope.tal.talinterpreter, line 346, in interpret
  Module zope.tal.talinterpreter, line 745, in do_insertStructure_tal
  Module Products.PageTemplates.Expressions, line 221, in evaluateStructure
  Module zope.tales.tales, line 696, in evaluate
   - URL: search_engine
   - Line 2, Column 0
   - Expression: <StringExpr 'my.searchengineportlets'>
   - Names:
      {'container': <ATTopic at /cms/portale/home>,
       'context': <ATTopic at /cms/portale/home>,
       'default': <object object at 0x1ab528>,
       'here': <ATTopic at /cms/portale/home>,
       'loop': {},
       'nothing': None,
       'options': {'args': ()},
       'repeat': <Products.PageTemplates.Expressions.SafeMapping object at 
0x6a3f760>,
       'request': <HTTPRequest, 
URL=http://www.biblioteche.unibo.it:15000/portale/home/folder_home3_summary_view>,
       'root': <Application at >,
       'template': <ImplicitAcquirerWrapper object at 0x6a33f30>,
       'traverse_subpath': [],
       'user': <PloneUser 'simone'>,
       'view': <Products.Five.viewlet.metaconfigure.SearchEngineViewlet object 
at 0x6a33c90>,
       'views': <zope.app.pagetemplate.viewpagetemplatefile.ViewMapper object 
at 0x6a33f90>}
  Module Products.Five.browser.providerexpression, line 25, in __call__
ContentProviderLookupError: my.searchengineportlets





-- 
---------------------------------------------
Dott. Simone Sacchi
CIB - Centro Inter-Bibliotecario
Alma Mater Studiorum - Universita' di Bologna

tel: +39 051 209 4276
fax: +39 051 209 4266
e-mail: simone a cib.unibo.it
           simone.sacchi a unibo.it
http://www.biblioteche.unibo.it/
http://almadl.cib.unibo.it
---------------------------------------------




Maggiori informazioni sulla lista Plone-IT