[z3-five] Re: [z3-checkins] r5244 - z3/Five/trunk

Philipp von Weitershausen philipp at weitershausen.de
Wed Jun 23 13:13:56 MEST 2004


Martijn Faassen wrote:
> Great work on fixing this issue!
> 
> What about the case where in TALES you want to say something like:
> 
> views['someview'](foo, bar, baz)

Note that 'views' is deprecated. You should use

   context/@@some_view

> Is that a legitimate use case?

I don't think so. The views you call from TALES are usually views 
providing a certain functionality, such as absolute URL. This 
functionality is described thru an interface, so we make them views 
providing an interface (queried using getViewProviding()).

Same goes for macros (context/@@standard_macros/foobar) where views 
aren't supposed to be called but to provide extra functionality. If 
views are to be called, they should provide a __call__ themselves. We 
shouldn't provide this rather hackish implementation of __call__ ourselves.

If you think about it, only browser pages have to provide __call__ 
because that's the API zope.publisher/ZPublisher expects. So, we're 
actually thinking about only having views providing IPublishedView or 
similar published. A published view would almost never be called from 
ZPT; it would be published by zope.publisher/ZPublisher.


On a side note: I think the metaclass majyck would allow us to not 
require browser views to inherit from Products.Five.browser.BrowserView. 
Instead we would mix this in using the metaclass stuff. That would make 
external products indepentend of Five-imports.
I'm not sure whether this would really work, since we might be mixing an 
ExtensionClass with a regular old-style class. Also, we would make an 
assumption that their classes are not new-style classes.

Philipp



More information about the z3-five mailing list