[Grok-dev] Re: grok.layer branch

kevin at mcweekly.com kevin at mcweekly.com
Sun Apr 15 14:26:38 EDT 2007

Quoting Martijn Faassen <faassen at startifact.com>:
> This sounds really cool! What's the status of your branch? Does it
> implement all the features you mention, including the way to name skins
> and such?
> I think I can find use of this pretty soon in my own projects, so it's
> really nice to see this work done. This would also form a good basis
> for the post-process ideas for theming that I've been chatting about.
> Regards,
> Martijn

Hi Martin,

Ok, so I went ahead and implemented the skin registration as well but  
with caveats.

Unfortunately the following approach is not possible without some kind  
of dynamic interface creation.

class  DebugLayer(grok.Layer):

class PublicLayer(grok.Layer):

class PublicSkin(PublicLayer):
     grok.skin('Public')   # ++skin++Public

class DevSkin(PublicLayer, DebugLayer):
     grok.skin('Dev')   # ++skin++Dev

grok.Layer is simply a subclass of interface.Interface, so  
grok.skin('Dev') raises a concrete attributes not allowed error.

The following pattern works...

class  Debug(grok.Layer):

class Public(grok.Layer):

class Dev(Public, Debug):

grok.defineskin('Public', Public) # ++skin++Public
grok.defineskin('Dev', Debug)     # ++skin++Dev

class DebugView(grok.View):
     grok.layer(DebugLayer) #also settable at module level

Functional tests are defined and pass, unit tests still need to be  
defined. Perhaps grok.defineskin should be grok.define_skin and  
grok.layer may be clearer as grok.use_layer or grok.set_layer.

Let me know what you think.

Kevin Smith

More information about the Grok-dev mailing list