[Zope3-dev] Re: browser:page (was re: scripter/designer concerns)

Shane Hathaway shane at zope.com
Wed Sep 10 15:17:09 EDT 2003


Garrett Smith wrote:
> Jeffrey P Shell wrote:
> 
>  > I also noticed that <browser:page> is being used to assign new traversal
> 
>> objects, with a name of "_traverse".  That also seems to go against 
>> some of what I expected of Zope 3 - less magic names.  Shouldn't that 
>> be registering a view/adapter for some IBrowserTraversal interface 
>> instead of registering a 'page' for '_traverse'?
> 
> 
> This is a good question -- IIRC, Shane once deemed the '_traverse' 
> convention a wart.
> 
> I'm not terribly bothered by it, but I would like to hear from others as 
> to what the correct approach is. I occasionally need to get a view of a 
> specific type for a context, and I'm currently using a naming convention 
> ala '_traverse'. I currently feel no guilt, but at some point I'd like 
> to clean things up.
> 
> It seems to me that neither views nor adapters will work. Views are 
> accessed by name (I want to access by interface), and adapters expect a 
> single argument to their constructor (views require two: context and 
> request).
> 
> This seems like a pretty substantial hole, or am I missing something?

I came to the conclusion that we need a more flexible adapter registry. 
   A traversal component is an adapter, not a view.  Adapters are always 
registered for one input and one output interface, but in this case we 
need two inputs.  There is no shortcut like representing the two inputs 
as a single interface--that wouldn't work.  So we need to expand the 
adapter registry to allow n-ary adapters (I once called them n-tuple 
adapters.)  The tricky part will be to make it efficient.  I suspect we 
don't need to worry about speed for an initial cut, though.

Shane




More information about the Zope3-dev mailing list