[Zope3-dev] Re: Get a template resource object from code.
Stephan Richter
srichter at cosmos.phy.tufts.edu
Sun Aug 28 15:56:34 EDT 2005
Hi Johan,
why are you trying to misuse the system so hard? Can you provide us with your
original use case?
On Tuesday 16 August 2005 18:23, Johan Carlsson wrote:
> 1. Resources gets registered as adapters in the Global Site Manager.
Yep.
> 2. The adapter is registerd to adapt from the current layer interface
> (defaults to IDefaultBrowserLayer) to the Interface interface (strange,
> why is that so I wounder?)
The Interface interface is just the default. Sometimes you want views to
provide other interfaces.
> 3. The layer interface I can look up byt calling:
> zapi.getUtility(ILayer, 'my_layer')
>
> Ok, fine. So from my View class I try the following:
>
> gsm=zapi.getGlobalSiteManager()
> layer = zapi.getUtility(ILayer, 'my_test')
> adapter=gsm.queryAdapter(layer, Interface, 'test_me.html')
This will not work, because layer is the actual layer interface. However,
queryAdapter expects an object that provides the layer interface. This object
is usually known as the request.
Regards,
Stephan
--
Stephan Richter
CBU Physics & Chemistry (B.S.) / Tufts Physics (Ph.D. student)
Web2k - Web Software Design, Development and Training
More information about the Zope3-dev
mailing list