Am Dienstag, 26. Juni 2007 12:43 schrieb Arne Nordmann:
> Hi,
> I tried to create my own skin for a website of mine. I used Phillip's
> book (2nd version) and tried to do everything analog (just different
> names and a slightly different file structure).
> If I call a test view (registered for IRootFolder) with the skin I get
> the following error:
> ComponentLookupError: ((< object at
> 0x886916c>, <zope.publisher.browser.BrowserRequest instance
> URL=http://localhost:9673/++skin++norro/test>), <InterfaceClass
> zope.interface.Interface>, 'h')
> (Full traceback attached)
> I don't know what this traceback wants to say. I'm wondering about the
> value of the name-parameter that seems to be 'h' in this case. Where
> does this 'h' come from? I really don't know where to look at.

Looking at the traceback, it seems that the lookup error is happening here:
File "/usr/lib/python2.4/site-packages/zope/app/basicskin/", 
line 41, in __getitem__
    page = getMultiAdapter((context, request), name=name)

And above there's this:

   - Warning: Macro expansion failed
   - Warning: zope.component.interfaces.ComponentLookupError: 
((< object at 0x886916c>, 
<zope.publisher.browser.BrowserRequest instance 
URL=http://localhost:9673/++skin++norro/test>), <InterfaceClass 
zope.interface.Interface>, 'h')

So it seems it's some macro-related problem, perhaps you check the 
metal:define-macro/metal:use-macro definitions.

However, this case shows me that I'm not the only one with such problems. 
These ComponentLookupErrors and cryptic tracebacks (at least for newbies) 
drove me mad and costed me hours to resolve. In the end it was always "my 
fault", e.g.:

- Forgot to add the appropriate  layer to the request
- Forgot to omit __parent__ in my formlib class
- Forgot to register something or registered it for the wrong interface

I'm curious how others deal with this problem because I'm often paralyzed by 
this ComponentLookupError. The traceback also does not show which interface 
my objects provide - for example it cannot be seen if a BrowserRequest 
provides a specific layer or not. To solve this problem, I had to insert 
something like "print IMyLayer.providedBy(request)" into the Zope source to 
find out what happens.

Maybe a Zope3 "newbie-debug"-mode would help a lot that throws a traceback 
like this (regarding to the original problem)?

... Original Traceback ...
--- Verbose Traceback ---
A query for a named adapter adapting from the object(s):

 - < object at 0x886916c> (providing IFolder)
 - <zope.publisher.browser.BrowserRequest instance 
URL=http://localhost:9673/++skin++norro/test> (providing IBrowserRequest)

to the interface:

- <InterfaceClass zope.interface.Interface>

With the adapter name 'h' could not be found.
Helpful tips how to resolve this are given at

Best Regards,

GPG key ID: 299893C7 (on keyservers)
FP: 0124 2584 8809 EF2A DBF9  4902 64B4 D16B 2998 93C7
Zope3-users mailing list

Reply via email to