[Zope-CMF] Skin Questions

Shane Hathaway shane@digicool.com
Thu, 31 May 2001 19:28:50 -0400


Chris Withers wrote:
> 
> > > So, my questions are:
> > >
> > > 1. How do I 'set' the skin for each user in this way?
> >
> >
> > You replace the tool with one which implements its interface according to
> > your policy.
> 
> Wow, that seems a little heavy handed for such a small change.

It really wouldn't be difficult at all.  There's a slight problem since
skins are selected before authentication takes place.  But your skins
tool could read the authentication tokens directly and choose based on
the user name. :-/

> Seb Bacon suggested:
> > You could just set up
> > the skin property on the Memberdata and hide the user interface for
> > changing skins from the members.
> 
> ...which seems simpler to me, would it work?

It would work.  People would have the ability to select the wrong skin
by adding query parameters to the URL, but unless you're making stuff
for both the government and webring junkies on the same server that
shouldn't really matter.

> <snip 'folder structure in skin layers'>
> > I played briefly with this as a way to "unmangle" the type name from the
> > names
> > of skin methods.  It half works, but the longer you interact with it,
> > the weirder
> > the URLs get.
> 
> How come?

Implicit acquisition at play, I'd guess.  There are ways to make this
idea work, though, and eventually I think we'll move in this direction.

> However, now I'd like the documents in those layers to be manageable like
> normal CMF content. I know this isn't currently possible, but I was
> wondering why and whether it's a case of "no-one's wanted to do that yet" or
> "the world will come crashing down around your ears if you try to do that,
> so don't".

It's a case of "we'd need a good reason". :-)

> > I'd be willing to be corrected (by Shane, anyway :) but my gut says that
> > your request would be punitively expensive (the skins name lookups get
> > called
> > a *lot*;  Shane once measured 4500 lookups for a single page).
> 
> Ewww... how come? Could the results be cached?

The problem is that implicit acquisition makes every name lookup check
the skin layers before continuing to the root of the site and finally
the REQUEST. So now there's a little "inverse caching" in there: if you
look up a name that isn't in the skins then it won't try to look in the
skins for that name again for the duration of the request.  Along with
the optimization of DirectoryView, this sped up CMF a great deal AFAICT.

> >  Why not
> > move the
> > skin methods to the filesystem, instead, and just "mount" them multiply
> from
> > there?
> 
> Hmmm... good idea, but I think the folders in question need to be TTW
> manageable...

It sounds like you really want to just grant limited access to the
management interface.

Shane