[Zope-CMF] Re: Directory-based skin layers?
Ricardo Newbery
newbery at dvgroup.com
Thu Apr 22 22:35:20 EDT 2004
At 1:35 AM +0200 4/23/04, Dieter Maurer wrote:
>Ricardo Newbery wrote at 2004-4-21 16:43 -0700:
>>Again, I'm trying to grok how this skinning machinery works and
>>looking for the best way to insert "local" skin layers (as opposed to
>>the "global" layers in the skins_portal).
>
>Not sure, I understand what you mean with "local".
>
>When "local" means "inside a subhierarchy",
>I would use another "Skinnable" object as root of this
>subhierarchy and define the "local" layers on this object.
>
>--
>Dieter
Sorry, I guess I should have included the text from my first post.
Basically, I would like to enable directory-based skin layers which
would take higher precedence than the layers defined in portal_skins.
I'm NOT talking about an access rule that would reset the skin name
OR a complete override of the portal_skins layers but rather a
mechanism that would acquire any skin layer folders in the current
directory and its parents and prepend them to the portal_skins layer
list.
I'm calling these directory-based skin layers, "local" skin layers,
and the ones defined within portal_skins, "global" skin layers.
I think I've puzzled out how to do this except for one part. A
Skinnable object first acquires from portal_skins before performing
the usual acquisition lookup. If I can get my modified portal_skins
tool to collect the local skin layers (a subclass of SkinsContainer?)
and prepend them to the global skin layers and return the result (as
a chain of acquisition-wrapped folders), the rest should be easy ;-)
The problem is I'm not sure how to get the portal_skins tool to
collect the local skin layers. As far as I can tell, the tool
doesn't "know" anything about the original object that acquired the
skin tool so how can it acquire the local skins that exist in the
original object's acquisition space? Hmm... something just occurred
to me... Since the skin tool is acquired via getattr, maybe I can
just crawl back up to the original object using aq_parent (can I do
this?).
Or is the better solution just to patch SkinnableObjectManager (maybe
just adding a couple of lines to __getattr__ to acquire the local
skin layers before acquiring the global skin layers) and leave the
portal_skins object alone?
Thanks for the help,
Ric
More information about the Zope-CMF
mailing list