[Zope-CMF] Lost in SkinSpace!

Jon Edwards jon@pcgs.freeserve.co.uk
Mon, 1 Jul 2002 11:27:21 +0100


Thanks Kevin,

That got me digging round and pondering a bit more! Two thoughts -

1. What would you call this DTML-method, and how would you make sure it is
always called (even if they go direct to the 'index_html' - eg. when they've
bookmarked it)?

Showing my ignorance of hotfixing/subclassing now, but if you called it
"setupCurrentSkin" (and probably made it a PythonScript for speed?), would
it get called instead of the function of the same name in Skinnable.py?
You'd then need to make sure the line "dtml-call setupCurrentSkin" went to
the right place, so could you do "dtml-call Skinnable.setupCurrentSkin", to
stop it calling itself recursively?

2. I'm going to be doing it this way throughout all my sites, so long-term I
think it will be slightly faster if I hotfix/subclass the source-code?

After further code-diving, I wonder if I'd be better to hotfix/sub-class
Skinnable.py, rather than SkinsContainer? One way might be to change the
"getSkinsFolderName" function (which is currently not implemented) to do -

    def getSkinsFolderName(self):
        # Returns local skin choice.
        sk_choice = context.skin_choice
        return sk_choice

Hoping Tres, Seb, or another guru will tell me if that's a good place to do
it! :-)

Cheers, Jon

> -----Original Message-----
> From: Kevin Carlson [mailto:khcarlso@bellsouth.net]
> Sent: 28 June 2002 18:07
> To: Jon Edwards; Roger Espinosa
> Cc: Zope-Cmf
> Subject: RE: [Zope-CMF] Lost in SkinSpace!
>
>
> Jon,
>
> I did a bit of testing and I've got a pseudo-solution working.
> If I call a
> DTML method that contains the following three lines of code, the skin is
> successfully switched:
>
> <dtml-call "REQUEST['RESPONSE'].setCookie('portal_skin', 'Test')">
> <dtml-call setupCurrentSkin>
> <dtml-call "REQUEST['RESPONSE'].redirect('index_html')">
>
> This will change to the 'Test' skin and redirect to the index_html method
> contained therein.
>
> Hope this helps,
>
> Kevin