[Plone-developers] Re: [Zope3-Users] Re: [z3-five] zope.viewlet and zope.contentprovider - options for Zope 2 and Plone 3

Jean-Marc Orliaguet jmo at ita.chalmers.se
Tue Apr 11 03:23:23 EDT 2006


Stephan Richter wrote:

>On Monday 10 April 2006 08:50, Jean-Marc Orliaguet wrote:
>  
>
>>Stephan Richter wrote:
>>    
>>
>>>On Sunday 09 April 2006 20:33, David Pratt wrote:
>>>      
>>>
>>>>The Z2 integration will be started soon at a sprint soon. Viewlets and
>>>>portlets seem pretty synonymous and cpsskins provides a way to
>>>>manipulate portlets visually which is very nice.
>>>>        
>>>>
>>>Viewlets are not portlets! Portlets are much more restrictive and the
>>>industry has a very specific meaning for the term, which differs from
>>>both, Plone's and CPS skins', usage of the term.
>>>
>>>Regards,
>>>Stephan
>>>      
>>>
>>Actually I've looked into creating a generic "viewlet" portlet that
>>would make it possible to reuse viewlets in cpsskins (for instance by
>>using the visual portlet editor). A feature that is missing is that
>>there is no easy way to find the list of registered viewlets. A viewlet
>>lookup mechanism would be needed, for instance a utility that returns a
>>list vocabulary items with viewlet's name and the factory.
>>
>>also something that seems strange is that some viewlets are dependent on
>>viewlet managers:
>>    
>>
>
>There is nothing strange at all about that. Viewlet managers are very 
>important for deciding which and how viewlets are shown. If you want viewlets 
>without viewlet managers, then use content providers. BTW, I do use both in 
>development depending on my needs.
>
>  
>
>>see for instance: zope/app/boston/viewlets/toolbar:
>>
>>class ToolBarViewlet(object):
>>    """I18n info viewlet."""
>>
>>    implements(IToolBarViewlet)
>>
>>    def macros(self, name):
>>        return self.manager.macros(name) <<<<<<<<<<
>>
>>    def menus(self, menuId):
>>        return getMenu(menuId, self.context, self.request)
>>
>>
>>So if I want to render a toolbar viewlet I need to instanciate the
>>corresponding viewlet manager. I would understand this if I wanted to
>>render all viewlets in a given area of the page, but if I want to render
>>just one viewlet?
>>    
>>
>
>Use a content provider then.
>
>  
>
>>Basically it introduces a cycle in the design: viewlet managers depend
>>on viewlets and viewlets depend on viewlet managers to be rendered.
>>    
>>
>
>Absolutely! This is the point. The API and communication between a viewlet 
>manager and its viewlets is very well defined. This is a win. Again, just use 
>content providers to have simple HTML snippets.
>
>Regards,
>Stephan
>  
>

Hi Stephan,

I do understand this. My point was that to reuse what other developers 
already have created, not necessarily to create new content providers 
from scratch. For instance I look at zope.app.boston.viewlets, I see 3 
interesting viewlets:  'addinginfo', 'toolbar' and 'xmltree', none of 
which can be reused in other projects without instanciating a viewlet 
managers (which by the way are extremely specific to the boston skin).

an 'onion skin' type of design, would have been possible. Now, one has 
to buy the entire onion.

( ( ( ContentProvider ) Viewlet ) Viewlet manager )

regards
/JM



More information about the Zope3-users mailing list