[Grok-dev] grok.Skin is not itself an Interface

Jan-Wijbrand Kolman janwijbrand at gmail.com
Tue Nov 20 08:29:54 EST 2007


Hi,


grok.Skin is not a subclass of Interface, like I *think* it should be to 
be compatible with Zope 3.

At the very least it can be confusing, when you try to automatically set 
a skin upon traversal with zope.publisher.browser.applySkin().

The grok.Skin component *only* is there to trigger the registration of 
FirstLayer as a skin, it is not "usable" itself. So you currently have 
to do this:

   class FirstLayer(grok.IGrokLayer):
       pass

   class FirstSkin(grok.Skin):
       grok.layer(FirstLayer)

   ...
     # in a IBeforeTraverseEvent event handler
     applySkin(request, FirstLayer) # feels counter intuitive

What I expected to be able to do:

   class FirstLayer(grok.IGrokLayer):
       pass

   class FirstSkin(grok.Skin):
       grok.layer(FirstLayer)

   ...
     # in a IBeforeTraverseEvent event handler
     applySkin(request, FirstSkin) # this reads much better and is Zope 3
                                   # "compatible".

What do others think?

regards,
jw



More information about the Grok-dev mailing list