[Grok-dev] How to effectively reuse viewlets?

Martin Aspeli optilude+lists at gmail.com
Sun Oct 18 06:37:09 EDT 2009

prinzdezibel wrote:

> I Martin,
> thanks for your reply. Could you please write down a sample snippet of code
> for your suggested solution. Because I tried to override the render method
> of the viewlet in my derived viewlet and got a ambiguous render method
> error, because my original viewlet is rendered from a template.

Viewlets are rendered by name. What I'm saying is, you do something like:

class BlankViewlet(grok.Viewlet):

     def update(self):

     def render(self):
         return ''

The key here is that you copy the directives from the original, but you 
use a skin-specific layer to override it, then you make it render to an 
empty string.


Author of `Professional Plone Development`, a book for developers who
want to work with Plone. See http://martinaspeli.net/plone-book

More information about the Grok-dev mailing list