[Zope3-dev] Re: difference between view and page
Steve Alexander
steve@cat-box.net
Fri, 09 May 2003 20:28:19 +0300
Shane Hathaway wrote:
> Jim Fulton wrote:
>
>> BTW, we've been thinking of defining a different kind of component for
>> traversers, but never got around to it. It's a (small) wart to use the
>> funny name to indicate traversal.
>
>
> +1. I created that wart and I never liked it. Does anyone (including
> Jim :-) ) know how we should transform this pattern? Could we use an
> adapter instead?
On various occasions, Jim has brought up the subject of multi-dependent
adapters.
That is, a standard adapter depends on the object that it is adapting,
optionally advised by a name. It gives you something that conforms to a
particular interface. The dependency is reflected in an adapter's
constructor: context
A view depends on an object it is presenting, and the request that is
being responded to, advised by a name. The dependency is reflected in
the arguments given to a view's constructor: context, request.
A traversal component depends on a request and an object, and gives you
something that conforms to IPublishTraverse. The dependency is reflected
in the arguments given to a traversal component's constructor: context,
request.
There are other examples to consider too, such as session data objects.
It would be nice if there were a way to adapt from N-tuples rather than
just from single objects.
--
Steve Alexander