[Grok-dev] Portlets (and maybe other skinning).

Darryl Cousins darryl at darrylcousins.net.nz
Sat Mar 17 19:28:59 EDT 2007


Hi,

On Sat, 2007-03-17 at 21:06 +0100, Lennart Regebro wrote:
> > grok needs support for viewlets. Let's come up with a good solution for
> > that.
> 
> After discussing with Philikon, I'm currently looking into replacing
> the publication object with something that looks up a main template
> and uses that, and passes all viewlet managers to it. The main
> template can then render the main design with all viewlets in the
> correct places. The idea is then to make a special viewlet that
> renders the actual object and outputs that.
> 
> This *may* work. I hope to get some time to finish a rough version tomorrow.
> 
> The main drawback with this is that everything gets the portlets
> applied to them, even non-grok-content, but I could probably check if
> the object is a grok view or not and just render non-grok objects
> normally.
> 
> And then there is the question of how to select different main
> templates for different views. You don't want a pop-up form to have
> the viewlets, for example.
> 

This seems not quite right to me. I like the way grok currently does not
enforce a 'main template' onto all views. 

I was thinking that skins and layers perhaps should come first. I
haven't attempted any code yet but along the lines of grok/doc/skin*.py
makes sense. (Though I've yet to grasp the distinction between layers
and skins). And thereafter providers can be registered to the skin, and
viewlets to the provider.

Something along the lines of:

class NewsProvider(grok.Provider): # grok.ViewletManager?
	grok.layer('main')
	grok.name('news')

class NewsViewlet(grok.Viewlet):
	grok.provider('news')

and in the skin (or layer?) 'main_template.pt':

<tal:block replace="structure provider:MenuProvider" />

Sincere regards,
Darryl



More information about the Grok-dev mailing list