[Zope-dev] Re: repoze.bfg

Malthe Borch mborch at gmail.com
Thu Jul 17 15:57:04 EDT 2008



Brandon Craig Rhodes wrote:
> Someone mentioned Vudo to me last week.  I said that I was tempted to
> write an extension to Grok that lets you create a "grok.Layout" template
> that maybe is inherited throughout your whole site if you don't specify
> otherwise, and then a "grok.View" on an object would just generate
> content for the "main" pane inside of that layout, and viewlets could
> keep working like they do today but fill in other parts of the layout.

Right, that's pretty much it. I should note that our layout is essentially:

-- a classic HTML document
-- whatever css and js it may reference
-- a set of mappings from region definitions to xpath expressions

> This is kind of how people look to be doing things today with the
> viewlets revolution that's going on in Grok land; look at:
> 
>  http://svn.zope.org/Grokstar/trunk/src/grokstar/blog.py?rev=87483&view=auto
> 
> and note how many of the "grok.View" objects are specifying the same
> dratted template, over and over again, and then rely on viewlets to
> actually fill in the varying parts of each page that change with the
> content.  It struck me as a situation that is just crying out for a
> "grok.Layout" local utility that provides the template everywhere under
> a part of a site automatically, so that the "grok.template(...)"
> declaration does not have to get repeated so incessantly.

Interesting approach. While I can see the benefit of being able to plug 
these viewlets in and out, it may be YAGNI. If you really wanted users 
to be able to plug, say, search *out*, how'd they do it? Perhaps 
portlets are better suited here.

With Vudo we really wanted to make sure that whatever the user might 
want to order around or otherwise manage, it was possible.

Viewlets are *great* for things like status-messages, document actions 
and other such helpers, but I'm not sure I like it as a means to compose 
pages.

> It really looks to me like Grok best-practices are evolving towards a
> layout-centric, rather than a macro-centric, approach, and that
> something like the Vudo approach would make this all easier to manage.

Yes, I'm very sure now that layouts are right and macros are wrong. It's 
an easy pattern to understand and it works well with designers.

\malthe



More information about the Zope-Dev mailing list