[Zope-dev] Re: default view

Philipp von Weitershausen philipp at weitershausen.de
Sun Jun 18 22:14:38 EDT 2006


Lennart Regebro wrote:
> On 6/18/06, Philipp von Weitershausen <philipp at weitershausen.de> wrote:
>> > The remaining important question is: if a *default* view is specified
>> > using the zope 3 mechanism, should we always treat it as a zope 3 view,
>> > and refuse to lookup an attribute with that name?
>>
>> Yep. browser:defaultView should only affect the view machinery.
> 
> OK, that means that the test in Five.browser.tests.test_defaultview
> lin 94 iw wrong, as it explicitly tests that they CAN be attributes.
> ;)
> 
>    This tests whether an existing ``index_html`` method is still
>    supported and called:
> 
>      >>> print http(r'''
>      ... GET /test_folder_1_/testindex HTTP/1.1
>      ... ''')
>      HTTP/1.1 200 OK
>      ...
>      Default index_html called
> 
> 
> From Five.browser.tests.defaultview.zcml:
> 
>  <browser:defaultView
>      for="Products.Five.tests.testing.simplecontent.IIndexSimpleContent"
>      name="index_html"
>      />
> 
> If you want to have non-views as browser default, we still need to use
> __browser_default__, then.

Hmm, perhaps browser:defaultView isn't such a bad idea then... :).
Actually, I don't have much of an opinion, to be honest. I just thought
that it would make sense that browser:defaultView only modified the
behaviour of Zope 3 views. The fact that it also modifies the behaviour
of the general traversal machinery in Zope 2 sounds like a blessing if
we get to avoid __browser_default__ this way; if it turns out to be a
curse for other people, then perhaps we need a five:defaultPublishedName
or something...

> The option is to allow attributes, and specify the browserdefault with
> @@ to force it to be a view.

Hmm. <browser:defaultView ... name="@@index.html" />??? That doesn't
sound right.

Philipp



More information about the Zope-Dev mailing list