[Zope3-Users] Re: Confused about skinning in Zope3
Luis De la Parra
lparrab at gmx.net
Sun Sep 17 16:43:39 EDT 2006
hello,
I'm not sure wether this is the right way to do it, but you can set up the
skin with a traverse-subscriber:
def myAppTraverseSubscriber(event):
"""A subscriber to BeforeTraverseEvent.
Sets the "AC" skin if the object traversed is a "MyApp"
instance.
"""
if (IMyApp.providedBy(event.object) and
IBrowserRequest.providedBy(event.request)):
applySkin(event.request, AC)
and then in the configure.zcml
<subscriber
handler=".skin.myAppTraverseSubscriber"
for="zope.app.publication.interfaces.IBeforeTraverseEvent" />
with this subscriber you don't have to explicitly set the skin: it will be
set "automatically" when you look up a url inside your application.
Theoretically you could set up the skin for individual objects like this,
but I don't know if it would be practical in real life... setting the skin
on an per-application basis is good enough for me though.
regards. luis
Philippe Clérié wrote:
> Hello list,
>
> As the title says I am somewhat confused by the skinning system in Zope3.
> I am following the example in "Web Component" (great book by the way) and
> at the time creating another app along the same lines. Now I set up both
> skins for each package and I _expected_ that each would pick up its own
> skin. So a recipe object would show with the worldcookery skin and my app
> would show with its skin (zsoc). Instead it seems that:
>
> a) skins are applied globally and not locally to the packages that own
> them;
>
> b) skins are not *picked up* unless directly referenced in the URL.
>
> Somehow that does not feel *natural*. Am I missing something?
>
> There's always a chance that I don't have the macros right, but I did copy
> worldcookery/browser/skin, just to make sure I made no mistakes.
>
> Thanks in advance
> Philippe
More information about the Zope3-users
mailing list