[Zope3-dev] Re: difference between view and page

Jim Fulton jim@zope.com
Thu, 08 May 2003 16:52:44 -0400


Garrett Smith wrote:
> I got my namespaces mixed up. The declaration for IHTTPPresentation is
> from the zope namespace, not browser. Oops
> 
> But...I did find another example of what I'm actually confused about:
> 
> <browser:page 
>     name="_traverse" 
>     for="zope.interface.Interface"
>     class="zope.app.publication.traversers.SimpleComponentTraverser" 
>     permission="zope.Public"
>     />
> 
> <browser:view 
>     name="_traverse" 
>     for="zope.app.interfaces.content.file.IFileContent"
>     class="zope.app.publication.traversers.FileContentTraverser" 
>     permission="zope.Public"
>     />
> 
> Here, it looks like view and page (both in browser namespace) are
> interchangeable.

This is a special case for which they happen to be interchangable.

Normally, browser:view is used when you have a named view with pages.

browser:page is used when you have a view that is a page on the content.

browser:pages is used (as a convenience) when defining several related pages.

Occasionally, you have browser views that aren't and don't have pages.
They do little bits of computation that are specific to browsers, like
computing urls or doing traversal.  I think I would prefer
using browser:view for those.

BTW, we've been thinking of defining a different kind of component for
traversers, but never got around to it.  It's a (small) wart to use the
funny name to indicate traversal.

Jim



-- 
Jim Fulton           mailto:jim@zope.com       Python Powered!
CTO                  (703) 361-1714            http://www.python.org
Zope Corporation     http://www.zope.com       http://www.zope.org