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

Philipp von Weitershausen philipp at weitershausen.de
Mon Mar 19 22:22:36 EDT 2007


Lennart Regebro wrote:
> On 3/18/07, Darryl Cousins <darryl at darrylcousins.net.nz> wrote:
>> Hi Lennart,
>>
>> On Sun, 2007-03-18 at 08:52 +0100, Lennart Regebro wrote:
>> > On 3/17/07, Lennart Regebro <regebro at gmail.com> wrote:
>> > But of course, since the object has a template that ouputs
>> > html/head/body tags, and the main template also does that (it has too)
>> > I get two of them.
>> >
>> > The question is, should I strip everything outside of the body and
>> > only insert the body, or should we require that all grok-views that
>> > make use of this only returns the actual body?
>> >
>> > Opinions? Or am I barking up the wrong tree?
>> >
>> >
>> > Anyone want to see the proof of concept code?
>> >
>>
>> But of course! :-)
> 
> OK here it is: http://svn.zope.org/megrok.viewlet/
> 
> I added Viewletmanager and viewlet classes and grokkers as well. It's
> my first grokkers, so I'm mainly guessing. :-)

I only glanced over this briefly, but here are some comments:

* Why do ViewletManager and Viewlet inherit from grok.Model? They're not 
Models nor persistent.

* You're registering ViewletManagers and Viewlets for None (=all 
objects) and not for context. Why?

* You're using 'main_template.pt' for the template that contains the 
macro. This is such a bad name. I can tell you've been working with the 
CMF for a loooooong time :).

* The "viewlets do it all" approach is certainly interesting, but it 
means that views themselves can't render whole HTML pages, only snippets 
of HTML (e.g. the contents of the <body> tag). So when megrok.viewlet is 
installed, all views would have to change (including Grok's own views 
from the admin UI, for example).


-- 
http://worldcookery.com -- Professional Zope documentation and training


More information about the Grok-dev mailing list