[Grok-dev] Re: layers and skins

Maurits van Rees m.van.rees at zestsoftware.nl
Mon Apr 23 16:15:49 EDT 2007


Martijn Faassen, on 2007-04-23:
> A skin is ever only associated with a single layer directly. Instead, 
> layers can be in a hierarchy:
>
> class IAnonymousLayer(Interface):
>     pass
>
> class IMemberLayer(IAnonymousLayer):
>     pass
>
> class IManagerLayer(IMemberLayer):
>     pass

Okay.

> Of course you might make it more complicated with multiple inheritance 
> and such. You could instead have three base layers and combine them 
> different ways for anonymous, member and manager.
>
> A skin is what takes a layer and turns it into something with a name 
> that can show up in the request (and later on hopefully title, menu 
> entry, etc).

Clear.

> I think so. If I'm not mistaken it's even possible for the EditView to 
> replace the BaseView entirely. As long as they have the same name 
> (grok.name) the one in the more specific layer will show up (the 
> IMemberLayer).

For the case of GrokChess this would be exactly the right thing to do.

> Grok isn't like Plone. You could build something like Plone on top of 
> Grok of course, but Grok itself actually isn't in the business of 
> providing a default user interface, so Grok won't be providing a skin.

"Plok: now even cavemen can use Plone!" ;-)

> class MySkin(grok.Skin):
>     grok.layer(IMyLayer)
>     grok.name('myskin') # actually the default
>
> Since there needs to be only a single layer associated with a skin (the 
> rest is done through inheritance), this is sufficient. In the future 
> when we gain a grok.menu(), this could be used to register the skin into 
> a particular menu as well.

Clear now.  Looks pretty workable.

-- 
Maurits van Rees | http://maurits.vanrees.org/ [NL]
            Work | http://zestsoftware.nl/
"Do not worry about your difficulties in computers,
 I can assure you mine are still greater."



More information about the Grok-dev mailing list