[Zope-CMF] Re: Working with Zope 3 skin layers
Charlie Clark
charlie at begeistert.org
Wed May 28 02:26:09 EDT 2008
Am 27.05.2008 um 16:48 schrieb Philipp von Weitershausen:
> Right. This will look up the 'detail.html' view for (context,
> request). Now it depends on what layers the request has applied to.
> Unless you've changed anything in the default skin configuration, it
> will have Zope's default skin. Since the 'detail.html' view above
> wasn't registered for the default layer but for soemthing else, it's
> not found.
>
>> <browser:page
>> for="Products.Charlie.event.interfaces.IEventDetail"
>> name="detail.html"
>> template="detail.pt"
>> class=".detail.DetailEdit"
>> permission="cmf.ModifyPortalContent"
>> />
>> is fine with /++skin++charlie/@@detail.html
>
> Yup, because if you don't specificy a layer explicitly,
> <browser:page /> will register a view for IDefaultBrowserLayer. Your
> charlie skin probably inherits from IDefaultBrowserLayer (either
> directly or indirectly). That's why this works.
>
>> Of course, this ties in with what I get from Zope - that the
>> adapter can't be found. I suspect I've misunderstood something
>> fundamental on how views work with layers.
>
> My book has a large section devoted to this. :)
I know. You're book is probably the most referred to technical book I
have! Very lucky that it was released as hard back. I've read the
section a couple of times and while I think I understand the
underlying mechanism...
What I think is still confusing me is:
1) I have created my dedicated skin
2) I have registered a view for that skin
I assumed that by registering the view for the skin, the view would
automatically use the right layer when called. The effect being much
the same as a customised view in a CMF layer: higher up the chain
takes precedence. But it seems that this is not the case: unless it is
set otherwise Zope will use the default skin. Is it possible to get
individual views to use different skins without using ++skin++ in the
URL?
>> Regarding CMFDefault - all views are registered explicitly for
>> ICMFDefaultSkin but I think this isn't necessary as this is
>> configured as the default skin.
>
> No, it *is* necessary, because the default skin can always change.
> In fact, nearly every application (in the Zope 3 world) sets the
> default skin (otherwise you'd need those hideous ++skin++ things in
> all URLs).
>
> Also, by explicitly putting all views on the ICMFDefaultSkin layer,
> those views are only there if your skin interface inherits from
> ICMFDefaultSkin. Which means you can easily "switch off" those CMF
> views by not including ICMFDefaultSkin. For some people this is an
> important use case.
Wouldn't that raise an error on startup if ICMFDefaultSkin isn't
found? Or how do you "not include" ICMFDefaultSkin? Using overrides?
Thanks for the help.
Charlie
PS: in your book the appendix to ZCML browser:defaultSkin says "see
browser:skin". This has been deprecated, I think.
--
Charlie Clark
Helmholtzstr. 20
Düsseldorf
D- 40215
Tel: +49-211-938-5360
GSM: +49-178-782-6226
More information about the Zope-CMF
mailing list