[Zope-CMF] [dev] add view traversal

Martin Aspeli optilude at gmx.net
Sun Sep 14 07:53:31 EDT 2008

Charlie Clark wrote:

>> b) for URLs like http://www.example.org/guestbook/+/Message
>> The '+' view already implements IPublishTraverse, so we can't change
>> traversal using an adapter. The only solution I can see is to replace
>> the '+' view by a customized version.
>> c) for URLs like http://www.example.org/guestbook/add/Message
>> If we use our own adding view, we can implement IPublishTraverse  
>> inside
>> the view or as adapter.
> I could live with either b) or c). I guess we need to weigh up the  
> desirability of being as close to Zope 3 style without unwanted side  
> effects. c) would to be the cleanest implementation. Would it be  
> possible to implement b) as a sort of alias for this if desired?

As I outlined in the other response:

  - Using '+' is not being "close to Zope 3". In Five, we already have 
an IAdding view called +, which is "close to Zope 3", but which has 
different semantics. It'd a great mistake, I think, to make something 
that *looked* like IAdding and wasn't. It'd also conflict with Plone, 
which *does* use IAdding in some cases, and I suspect other CMF users too.

> I guess the circle we're trying to square here would be what's the  
> best way to be able to add objects to a particular container. Our  
> particular experience has been to rely on the need to register views  
> for a particular container object but, of course, you still need type  
> information. As the type information (allowed content types for a  
> container object) is always required it probably makes sense to use  
> this rather than an implicit allowability through a registered view. I  
> think this means +1 for registering for the traverser.

Again at the risk of repeating myself, I don't think this really works. 
It's important that the context of the view is the container object and 
not another view (the traverser). Otherwise, we should go back to 
IAdding and use what's in Five already :)

> Absolutely. We've found the add forms to be extremely useful but the  
> dependence on knowing the name of the view is a pain even if you can  
> enforce a naming convention.

That's a bit like any view, though, surely? :)


Author of `Professional Plone Development`, a book for developers who
want to work with Plone. See http://martinaspeli.net/plone-book

More information about the Zope-CMF mailing list