[Zope] Skinnable products

Max Møller Rasmussen maxm@normik.dk
Mon, 27 Aug 2001 13:06:22 +0200


I could really need some ideas for making a skinnable Python product.

I am developing a Product, once more, but this time I am trying to make it
skinable. I have written a basic module that can be re-used for all kinds of
functionality.

What I need is some way to select a skin. First I thought of making the
product subclass the objectManager and then make another objectmanager
inside that that holds the skins. Like::

myProduct/
    skins/
        skin1
        skin2
        ...

Then by means of pushing the right skin folder onto the namespace the
product could use different skins.

But it seems like a waste of resources to have the dtml files duplicated all
over the site. So I wondered if it might be possible to do something like
the below pseudo-code.

Or maybe somebody else has a better idea??

class myProduct:

    skins = objectManager()
    skins._setObject('skin1', objectManager())
    skins.skin1._setObject(HTMLFile('skin1/index_html'))
    skins.skin1._setObject(HTMLFile('skin1/view'))
    skins.skin1._setObject(HTMLFile('skin1/edit'))
    skins._setObject('skin2', objectManager())

What I want to acheive is to have the skins a class properties, not instance
properties. This way I could make a bunch of skins that could be selected
from by setting a 'skin' property to the name of the 'skin' in the 'skins'
folder.

like::

    skin = 'skin1'

I don't need tested ideas, but would really like some input for ideas as for
how to do this.

regards Max M