[Zope3-Users] Combining Views

Christian Lück christian.lueck at ruhr-uni-bochum.de
Thu Mar 23 19:02:46 EST 2006


David Johnson wrote:
> I have a container and I would like to combine the views of the container
> objects.  Does anyone have suggestions?  This is rather simple and complex
> at the same time.
> 
>  
> 
> Basically, what I'm trying to do is to display a rather complex form and I
> want it to consist of the objects in container.    
> 
>  
> 
> Imagine buying a car online.  Consider the following Zope object layout:
> 
>  
> 
> Truck Container:
> 
> + Four Well Drive Options
> 
> + Four Runner Container:
> 
> ++ Seat Options
> 
> ++ Stereo Options
> 
> ++ Color Options
> 
> ++ Running Board Options
> 
> + Sequoia Container:
> 
> ++ Seat Options
> 
> ++ Stereo Options
> 
> ++ Color Options
> 
> + Tacoma Container:
> 
> ++ Tow hook Options
> 
> ++ Stereo Options
> 
> ++ Color Options
> 
>  
> 
> I know only two ways to achieve this objective now, neither which I like.
> 
> 1. Create a view on the container that calls my showOptions subroutine,
> which in turn calls a predefined and specific view class for each content
> type.  The problem is the large number of conditionals, and its hard to add
> more options without modifying each class and hardcoding the content types.
> 

Try zapi.getView and zapi.queryView
See Philikons book P.378 as a first reference.

> 2. Create a subroutine "getForm()" in each content object, [...]

I feel strong dislike because that would mix content code with
presentation code.


Regards,
Christian


More information about the Zope3-users mailing list