Ok, so far I figured out the following:

1. Resources gets registered as adapters in the Global Site Manager.
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?) 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:

        layer = zapi.getUtility(ILayer, 'my_test')
        adapter=gsm.queryAdapter(layer, Interface, 'test_me.html')

But this doesn't work, I get the following error:

Error type: exceptions.KeyError
Error object: <weakref at 02545900; to 'Surrogate' at 0210CAF0>

File "C:\Python24\Lib\site-packages\zope\publisher\publish.py", line 138, in publish

File "C:\Python24\Lib\site-packages\zope\app\publication\zopepublication.py", line 164, in callObject

File "C:\Python24\Lib\site-packages\zope\publisher\publish.py", line 113, in mapply

File "C:\Python24\Lib\site-packages\zope\publisher\publish.py", line 119, in debug_call

File "C:\Zope\Zope31\lib\python\wfc\browser\metasite.py", line 44, in __call__
    adapter=gsm.queryAdapter(layer, Interface, 'test_me.html')

File "C:\Python24\Lib\site-packages\zope\component\site.py", line 70, in queryAdapter
    """Set all module' __file__ attribute to an absolute path"""

File "C:\Zope\Zope31\lib\python\zope\interface\adapter.py", line 414, in queryAdapter
    return self.adapter_hook(interface, object, name, default)

File "C:\Zope\Zope31\lib\python\zope\interface\adapter.py", line 404, in adapter_hook
    factory = self.lookup1(providedBy(object), interface, name)

File "C:\Zope\Zope31\lib\python\zope\interface\adapter.py", line 392, in lookup1
    return self.lookup((required,), provided, name, default)

File "C:\Zope\Zope31\lib\python\zope\interface\adapter.py", line 327, in lookup
    byname = s.get(provided)

File "C:\Zope\Zope31\lib\python\zope\interface\adapter.py", line 227, in get

File "C:\Zope\Zope31\lib\python\zope\interface\adapter.py", line 146, in clean

File "C:\Zope\Zope31\lib\python\zope\interface\adapter.py", line 248, in unsubscribe
    del self.dependents[dependent]

File "C:\Python24\lib\weakref.py", line 216, in __delitem__
    del self.data[ref(key)]

Can somebody sched a light on this problem?


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

Zope3-users mailing list

Reply via email to