[Zope3-dev] Using parent references rather than context wrappers to represent containment

Phillip J. Eby pje at telecommunity.com
Sun Aug 10 14:02:12 EDT 2003


At 07:22 PM 8/10/03 +0300, Steve Alexander wrote:

>>     3. Optionally allow vies wo implement 'IContained' and add
>>        'IContained' support to BrowserView.
>
>A content object does not contain its views. In the proposal you said "We 
>don't want to mix up containment with other associations".

For what it's worth, in peak.web a view's context is the view that it was 
found in, not the object it's adapting.  That is, if you have a content 
object O, with a container C, then a view Vo of object O will have view Vc 
of container C as its parent.  The overall structure looks like a ladder: 
parallel verticals of view-to-view connections and conent-to-content 
connections, with horizontal rungs of view-to-content references.

This structure allows a view defined for a containing component, to provide 
configuration for views of contained components.  If a view were to instead 
treat its adapted subject as its container, then it cannot do this.

Of course, all this may not be a useful point of comparison, because in 
peak.web, views also function as traversal adapters for the underlying 
component (which eliminates the need for the notion of "named views" or 
"named adapters").




More information about the Zope3-dev mailing list