[Zope-CMF] Forcing skins by role

Paul Winkler pw_lists@slinkp.com
Sun, 25 Aug 2002 13:17:01 -0700


On Sun, Aug 25, 2002 at 09:12:16AM +0200, Dieter Maurer wrote:
> Tres Seaver writes:
>  > > ... setting skins after authentication ...
> 
>  > > Looks like I'm going to need to go in a different direction.
>  > > Maybe I can have a method that sets the skin and is always
>  > > called by my main_template of every skin.
> I doubt that this will work (though, I am not sure):
> 
>   Apparently the skin tool is set up, when the portal object
>   is "__bobo_traverse__"d
> 
>   It may not have an effect, when you change the skin variable later.

I've already confirmed that changeSkin(skin_name) can be called
in a template and does exactly what you tell it to do.
(I haven't tried calling it in the *middle* of a template, but
it's fine at the beginning.)

>  > Another alternative would be to create a custom security policy (derived
>  > from AccessControl.ZopeSecurityPolicy) and arrange to do the skin
>  > setting from within its 'validate' method.  You would then modify your
>  > startup code (e.g. z2.py) to install your own, custom policy.
> I am not sure whether I would like such an approach.
> 
>   "validate" is called extremely often, for every access from
>   a protected area. It should be as lightweight as possible
>   (therefore, it has been recently implemented in "C").

Aside from this, it would affect my entire Zope site.
It's only a small portion that I'm trying to do this
skins magic with.  I'd rather not pollute everything
else with such a hack.  But thanks for the
suggestion.

--PW


--

Paul Winkler
"Welcome to Muppet Labs, where the future is made - today!"