I thought this would be a simple case for Zope3, but after one whole
day I am not able to find a clean solution. Must be missing something.

Suppose I have a BookShelf  which contains lots of Books. The view for
BookShelf will show a list of Books contained in the shelf, and when
the user click on a book, a detailed view for the Book will be opened.

Of course the Book rendered in the shelf will be different from the
same rendered in the book detail view. But how best to achieve this in

The triditional solution (zope 2) I am familar with would be to use
<tal:repeat> in the page template for the shelf like this:

<div tal:repeat="book shelf/books">
  <h3 tal:content="book/title" />
  <p tal:content="book/auther" />

This however mixes the presentation of the shelf itself with the books
on the shelf. If I want to change how books looks like on the shelf, I
have to modify the shelf template, which doesn't seem to be a good
separation of concerns.

Is it possible to register two different views for the Book, one for
display in shelf, another for the detailed view? The one for the
detailed view is simply a BrowerPage, but how to do the book-in-shelf
view? I'd like for my shelf template to look something like this:

<div tal:repeat="book shelf/books">
  <div tal:replace="structure book/in-shelf-view />

Then I can maybe register different in-shelf-view's for different type
of shelves.

I tried registering a browser:view named 'in-shelf-view' for IBook. It
doesn't work, because TALES doesn't know about the view.

Thanks for any suggesions as to in what direction I shall research.

Hong Yuan

Zope3-users mailing list

Reply via email to