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

Stephan Richter srichter at cosmos.phy.tufts.edu
Tue Apr 11 02:10:06 EDT 2006


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
-- 
Stephan Richter
CBU Physics & Chemistry (B.S.) / Tufts Physics (Ph.D. student)
Web2k - Web Software Design, Development and Training


More information about the Zope3-users mailing list