Hi Johan On Behalf Of Johan Carlsson > Sent: Wednesday, August 17, 2005 7:59 PM > To: Dominik Huber > Cc: [email protected] > Subject: Re: [Zope3-Users] Making site skins > > > Some small success :-) > > I've figured out (thanks to input Dominik, others, and reading the > source): > > - how to change the current skin > - how to load a resource from that skin > > The following is currently running in my test View class: > > ns='resource' > name='test_me.html' > request=self.request > object=self.context > > #Look up the skin interface > adapters = zapi.getSiteManager().adapters > skin = adapters.lookup((providedBy(self.request),), IDefaultSkin, '') > skin = zapi.getUtility(ISkin, 'my_test') > > #Change the defaultSkin of the current request > if skin is not None: > directlyProvides(self.request, skin) > > #Get the traversal adapter for the namespace (e.g. resource) > traverser = zope.component.queryMultiAdapter((object, request), \ > ITraversable, ns) > if traverser is None: > raise TraversalError("++%s++%s" % (ns, name)) > > #Traverse the resource (e.g. 'test_me.html) > resource = traverser.traverse(name, ()) > return resource()
Take a look at: src\zope\app\demo\skinpref It's a demo how you can use preferences for to switch the skin. Probably you can use some parts from there. Regards Roger Ineichen Projekt01 GmbH www.projekt01.ch _____________________________ END OF MESSAGE _______________________________________________ Zope3-users mailing list [email protected] http://mail.zope.org/mailman/listinfo/zope3-users
