[Zope3-Users] Re: viewlets for specific interfaces

Stephan Richter srichter at cosmos.phy.tufts.edu
Fri Sep 15 13:34:32 EDT 2006


On Thursday 14 September 2006 14:21, Luis De la Parra wrote:
> wow. thanks for the offer... maybe I'm doing something wrong somewhere else
> then. I'm attaching a minimal package which (does not) work(s) for me:

Here is you problem:

You registered the page "viewlet.html" as follows:

  <browser:page
    for="*"
    name="viewlet.html"
    template="index.pt"
    permission="zope.View"/>

For some reason this caused this view to be really a view the default view 
(index.html), so that you implicit traversal was:

file.txt/@@index.html/@@viewlet.html

... or something like that. I did not investigate further. Then I changed the 
registration to:

  <browser:page
    for="zope.app.file.interfaces.IFile"
    name="viewlet.html"
    template="index.pt"
    permission="zope.View"/>

and everything worked just fine. Whether the described traversal behavior is 
correct I cannot say without a bit more digging, which I have no time for 
now.

How did I figure that out? I went to zope.viewlet.manager.ViewletManagerBase 
and did some debugging just before the viewlets were looked up and found that 
the context was not what you would expect. I immediately knew that the page 
"viewlet.html" was working onto the wrong context and thus registered it for 
the specific interface and everything worked.

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-users mailing list