[Zope-CMF] CMF add views and <browser:page />

yuppie y.2008 at wcm-solutions.de
Fri Dec 12 07:37:02 EST 2008


Hi!


Martin Aspeli wrote:
>> Providing customized solutions for specific use cases makes it easier to 
>> solve these use cases, but it also makes the framework more complex and 
>> less framework-ish.
> 
> Then why do we have <browser:page />?

I guess primarily for historical reasons. And because zope.app is in 
some parts an application, not a framework. And because the 'template' 
attribute is sometimes a convenient shortcut.

> You could of course do:
> 
> <adapter
>    for=".interfaces.IMyType
>         Products.CMFDefault.interfaces.ICMFDefaultLayer"
>    provides="zope.interface.Interface"
>    name="myview"
>    factory=".myview.MyView"
>    />
> <class class=".myview.MyView">
>    <require
>        permission="zope2.View"
>  
> allowed_interface="zope.publisher.interfaces.browser.IBrowserPage"
>    />
> </class>

The <class/> hack is not necessary in Zope 3. This is much closer to 
<browser:page/> and easier to read:

<adapter
    for=".interfaces.IMyType
         Products.CMFDefault.interfaces.ICMFDefaultLayer"
    provides="zope.publisher.interfaces.browser.IBrowserPage"
    name="myview"
    factory=".myview.MyView"
    permission="zope2.View"
    />


Cheers,

	Yuppie



More information about the Zope-CMF mailing list