[Zope-CMF] Re: Method Aliases

Janko Hauser janko at need-brain.de
Tue Sep 30 10:44:55 EDT 2003


On Tue, 30 Sep 2003 09:57:05 -0400 (EDT)
Shane Hathaway <shane at zope.com> wrote:

> That's another thing wrong with this.  I don't think it should be
> possible to override methods using method aliases.  What I'm
> suggesting is to use method names that are not overridden.
> 
> The vision is good, but Zope 2 can't support many traversal hooks
> without a high cost in understandability and speed.  Take a look at
> Zope 3 instead.  Zope 3 completes the vision with not just skins,
> but view components, rather than a big pile of methods.  Please
> check it out.
> 

We have done it, and have implemented in a first try the concept of
view classes in Zope2. But the current result smells funny :-)

On the types with a view class there needs to be a __bobo_traverse__
to catch the call of a method like doc/edit. Then we use something
like getadapter to instantiate a view class and put these between the
doc and its parent in the acquistion path. 

folder/doc/edit  --> folder/vc/doc/edit

the edit() is now the method of the viewclass. All fine, although we
actually want to have more than one view class for an object. Bad
thing is, that, in order to not always write
self.context.getsomedata() in the view class we need to overwrite
__getattr__ in the view class, which is problematic. Actually it works
but we would appreciate ideas for other approaches. Important is, that
view class have only a lifetime of a request (perhaps later on a
session) and are dynamically instantiated at the beginning of the
request.

critiques appreciated,

__Janko




More information about the Zope-CMF mailing list