Browser views: inherit from object or BrowserView from Five/Plone

Wichert Akkerman wichert at wiggy.net
Wed Apr 18 19:10:57 UTC 2007


Previously Martin Aspeli wrote:
> Maurits van Rees-3 wrote:
> > Inherit from Plone
> > ------------------
> > 
> >     from Products.CMFPlone import utils
> >     class MyView(utils.BrowserView):
> > 
> > Acquisition wrapped, same as Five.
> > 
> > But in the __init__() of this BrowserView there is the line:
> > 
> >     self.context = [context]
> > 
> > So you cannot use self.context in your code like you would do in the
> > other cases, but you have to use this:
> > 
> >     context = utils.context(self)
> > 
> > This is the only thing that is different from the Five BrowserView.
> > All the browser views in CMFPlone/browser use this.
> > 
> 
> I really hate this view, and we're not using it any more in new views in
> Plone 3. This is because:
> 
>  - It makes self.context a list; this breaks compliance with the
> IBrowserView interface
>  - You have to use that silly utils.context() thing
>  - It makes everything have a hard dependency on Products.CMFPlone

That view has been annoying me as well. Perhaps we should just get rid
of it now.

Wichert.

-- 
Wichert Akkerman <wichert at wiggy.net>    It is simple to make things.
http://www.wiggy.net/                   It is hard to make things simple.




More information about the Product-Developers mailing list