[z3-five] Bug in defaultView?

Richard Waid richard at iopen.net
Sun Oct 8 06:50:30 CEST 2006


This could be a bug, or it could be a misunderstanding of how
browser:defaultView is supposed to work in Five. I'm also using
Zope-2.9, so this may be 'fixed' in a later version of Five/Zope too.

Ok, basically I want to have a defaultView of index.html on objects that
implement an index.html view, otherwise fallback to index_html.

The __browser_default__ method in viewable.py/Viewable suggests that
this should be the behaviour (it has a fallback that says it falls back
to index_html), except that the path returned from
IBrowserDefault(self).defaultView(request) is _always_ index.html.

Here's an example. IGSContentFolder is a marker interface that is
(typically) used on a Folder to provide some views, including an
index.html. Not _all_ Folder objects are marked with this interface. But
when I do:

---
  <browser:defaultView for=".interfaces.IGSContentFolder"
                       name="index.html"/>
  
  <five:defaultViewable class="OFS.Folder.Folder"/>
---

ALL Folder objects only ever return 'index.html', even when the object
doesn't implement that (because it isn't marked as IGSContentFolder). I
can kinda see that this could be because of the global defaultView being
set to index.html. If that is the case, my question then becomes ... how
_do_ I set a default view of index.html only on a subset of Folder
objects?

I suspect we may have legacy code which uses index_html implicitly
(Zope2 encouraged such behaviour at times ;)).


Many thanks,
--Richard



More information about the z3-five mailing list