[Zope-CMF] Lost in SkinSpace!

Kevin Carlson khcarlso@bellsouth.net
Fri, 28 Jun 2002 10:19:15 -0400


Jon,

Could you set the portal_skin REQUEST variable equal to your skin_choice
variable when necessary without modifying source?

Kevin

-----Original Message-----
From: zope-cmf-admin@zope.org [mailto:zope-cmf-admin@zope.org]On Behalf
Of Jon Edwards
Sent: Friday, June 28, 2002 6:30 AM
To: Zope-Cmf
Subject: [Zope-CMF] Lost in SkinSpace!


I'm trying to hack the Skins mechanism to allow different skins to be used
by different parts of the site, but I'm a bit lost in the source-code!

I've added a "skin_choice" variable to PortalFolders, so that the site-admin
can choose which skin should be used in that part (to allow
sites-within-sites). The logic I'm aiming for is something like -

    if the "portal_skin" variable is set in Request, use it;
    else, if the "skin_choice" variable is set locally, use it;
    else, use the defaultskin

After much code-diving, I think I need to do this in the SkinsContainer.py
getSkin method. Something like -

    def getSkin(self, request):
        '''
        Returns the requested skin.
        '''
        varname = self.getRequestVarname()
        name = request.get(varname, None)
*       if name is None:
*           name = context.skin_choice
        skinob = None
        if name is not None:
            skinob = self.getSkinByName(name)
        if skinob is None:
            skinob = self.getSkinByName(self.getDefaultSkin())
            if skinob is None:
                skinob = self.getSkinByPath('')
        return skinob

Am I on the right lines? Is this a reasonable way to achieve it?

TIA

Cheers, Jon



_______________________________________________
Zope-CMF maillist  -  Zope-CMF@zope.org
http://lists.zope.org/mailman/listinfo/zope-cmf

See http://www.zope.org/Products/PTK/Tracker for bug reports and feature
requests