[Zope3-Users] Skins with multiple layers using interface approach

Philipp von Weitershausen philipp at weitershausen.de
Thu Aug 14 03:45:49 EDT 2008


andrew wrote:
> from z3c.layer.pagelet import IPageletBrowserLayer
> from z3c.form.interfaces import IFormLayer
> from z3c.formui.interfaces import IDivFormLayer
> from z3c.formui.interfaces import ITableFormLayer
> 
> 
> class IVortexBrowserLayer(IFormLayer, IPageletBrowserLayer):
>     pass
> 
> class IVortexBrowserSkin(ITableFormLayer, IVortexBrowserLayer):
>     pass
> 
> However, I've now created a second skin for the application but I want
> to have all the views, resources, etc., that have been registered
> to IVortexBrowserLayer to be available to this new skin without having
> to modify a lot of existing code. I can understand the old approach:
> 
> <skin name="blah" layers="layer1 layer2"/>
> 
> where you can acquire resources from a hierarchy of layers, but how do I
> do this with the interface approach ?

Just the same. Just have your second skin extend IVortexBrowserLayer as 
well:

   class IVortexSecondSkin(IVortexBrowserLayer, <more-layers-here>):
       pass



More information about the Zope3-users mailing list