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()


Cheers,
Johan

--
Johan Carlsson          Tel: + 46 8 31 24 94
Colliberty              Mob: + 46 70 558 25 24
Torsgatan 72            Email: [EMAIL PROTECTED]
SE-113 37 STOCKHOLM

_______________________________________________
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users

Reply via email to