[Grok-dev] How to effectively reuse viewlets?

Martin Aspeli optilude+lists at gmail.com
Mon Oct 19 09:27:56 EDT 2009


Jeroen Michiel wrote:
> 
> Martin Aspeli-3 wrote:
>> Viewlets kinda suck, to be honest. They are useful for certain use 
>> cases, but as a general way to build composite UIs, they suffer from 
>> some limitations.
>>
> 
> What are the alternatives? I am creating a fairly complex project, and
> indeed, viewlets can get in your way, but I got them to work. I read all the
> tutorials and howtos here, and based on that it seemed to me that viewlets
> were the way to go for more comple UIs. I don't think I really came across
> any alternatives mentioned on the grok site, apart from macro's, but that
> looked to be even more trouble and code repetition.
> 
> The main problem I have with viewlets is rendering forms. I have a specific
> layout that I want to see repeated on all pages. There is no such thing as a
> 'Formlet', so I first define the view in which the form should be rendered,
> I then define a form (e.g. grok.AddForm) that renders the form and defines
> the needed actions, and finally i define a viewlet that forwards the
> rendering to the form class. This is quite convoluted... Is there a better
> solution?

I think someone else will need to answer this question for Grok - I'm 
not sure what people normally do. :-/

Martin

-- 
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