[Zope3-Users] Re: Re: Confused about skinning in Zope3
Thanks for both replies. I haven't gotten that far yet to understand and apply the solution. But it's duly noted and I'll use it ASAP. All the best Philippe Albertas Agejevas wrote: > On Sun, Sep 17, 2006 at 10:43:39PM +0200, Luis De la Parra wrote: >> Philippe Clérié wrote: >> > 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? > > No, both of these points are correct. > >> 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) > > Yep, this is the canonical way to make skins apply to certain kinds of > objects automatically. > > Albertas ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
Re: [Zope3-Users] Local override on a view
On Sunday 17 September 2006 17:26, George Lee wrote: > If view V adapts interface I1 to interface I2, how do I allow a local site > inside my Zope instance to use view W to adapt I1 to I2 instead? > > Register a local view? Use overrides.zcml? I cannot find documentation on > these options, just scattered references to them. Local views in the ZODB would work, but that would be difficult to do. I suggest looking at z3c.baseregistry instead. Regards, Stephan -- Stephan Richter CBU Physics & Chemistry (B.S.) / Tufts Physics (Ph.D. student) Web2k - Web Software Design, Development and Training ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
[Zope3-Users] Re: Adapter lookup given object with multiple candidate interfaces
George Lee wrote: If an object X implements both interfaces I1 and I2, how does an adapter Y which can either map from I1->I3 or I2->I3 determine Y(X)? You got several things wrong here: * things are adapted by calling an interface, e.g. I3(X), not Y(X) * not the adapter determines the return value of the adaption, but the adapter registry. I3(X) yields to an object that provides I3. The fact that it's Y is due to the fact that you registered Y as an adapter for I1 and I2. * If an object X *provides* (which is different from "implements") I1 and I2 (in that order!), and you have an adapter from I1 to I3 and one from I1 to I3, then the adapter that maps from I1 to I3 will be chosen when you do I3(X). That's because X provides I1 first, then I2. The order matters. I suggest you read some docs on adaption. http://worldcookery.com/Appetizers has a few. Philipp ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
[Zope3-Users] Local override on a view
If view V adapts interface I1 to interface I2, how do I allow a local site inside my Zope instance to use view W to adapt I1 to I2 instead? Register a local view? Use overrides.zcml? I cannot find documentation on these options, just scattered references to them. Peace, George ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
Re: [Zope3-Users] Re: Confused about skinning in Zope3
On Sun, Sep 17, 2006 at 10:43:39PM +0200, Luis De la Parra wrote: > Philippe Clérié wrote: > > 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? No, both of these points are correct. > 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) Yep, this is the canonical way to make skins apply to certain kinds of objects automatically. Albertas ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
[Zope3-Users] Adapter lookup given object with multiple candidate interfaces
If an object X implements both interfaces I1 and I2, how does an adapter Y which can either map from I1->I3 or I2->I3 determine Y(X)? Peace, George ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
[Zope3-Users] Re: Confused about skinning in Zope3
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 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 ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
[Zope3-Users] Confused about skinning in Zope3
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 ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users