[Grok-dev] pagelets/layouts in grok

Martijn Faassen faassen at startifact.com
Mon Jan 12 11:49:11 EST 2009


Hi there,

Christian Klinger wrote:
> on the Grok-Sprint in Rotterdam we had a discussion about integration of
> z3c.pagelets in grok. If i remember correctly Christian Theune showed as 
> a presentation how pagelets and layouts work.
> 
> I found a blueprint on grok-launchpad site but unfortunatly with no 
> content. [1] :)
> 
> Is there any progress in this direction?
> What would you expect form a megrok.pagelet addon package?

No progress so far. I wish there were, so I'm happy you're bringing it up!

Some design thoughts I have:

* it's reasonable to start with megrok.pagelet with a Pagelet class. We
   can experiment with things there before possibly folding this into
   Grok itself.

* it should always be possible to swap out grok.View with Pagelet and
   have things work exactly the same without doing any extra work.
   A Pagelet is a view which does one extra thing - wrap the layout
   thingy around whatever it's viewing.

* One exception: don't bother supporting the 'render()' method for now.
   This is going to be factored out grok.View anyway. Just support
   regular template-based rendering.

* There is a new directive to indicate the layout template on the
   pagelet. grok.layout()? Now I get fuzzy - I don't recall exactly how
   this works with ZCML pagelets. How are these things registered and
   looked up? Someone needs to do some research and
   describe what's going on, and make some proposals for Grok. We should
   be inspired by the current pagelet story but we don't have to
   slavishly follow it either - I think we need more than just a simple
   translation of the ZCML directives to Grok.

* The rule that things will just work by simply swapping View for
   Pagelet implies that we want there to be a default layout
   that does absolutely nothing. This means that grok.layout (or
   whatever it is called) needs to have a default that does
   nothing.

* We need to consider interaction with layers. Can perhaps a layer
   define a layout that's used for everything that is in that layer?
   In this case we might not need a grok.layout directive for
   Pagelet at all, but instead only allow its use on layers. Perhaps
   this makes no sense at all though - I haven't through this
   through at all. How would this work with extensions overriding
   layouts, multiple layers in a skin, etc?

* I think it'd be nice if eventually grok.View could gain pagelet-like
   functionalities and we can do away with any extension. This kind
   of functionality is useful to have out of the box, but shouldn't
   break existing applications.

* We need to answer questions like: how would an extension override the
   layout of a core project? How can an extension introduce a layout
   while the core didn't have one yet (it used the default layout)?

I think the best steps would be:

* investigating the current pagelet story and summarizing how it works.

* writing a document that describes how things should work in Grok,
   covering various use cases. This document is what eventually should
   document the feature.

* worry about implementation. I suspect that this is a minor part of
   the actual work involved.

Don't worry about getting it all right in first draft however - just 
throw it out there and eventually we'll hopefully sort it out. If you 
want to experiment by coding up a prototype first that's fine as well; 
that's one way we can get our thoughts sorted out too.

Regards,

Martijn



More information about the Grok-dev mailing list