[Zope3-dev] formlib addForm

Christian Lueck christian.lueck at ruhr-uni-bochum.de
Mon Sep 26 22:05:51 EDT 2005


Gary Poster wrote:

>
> On Sep 25, 2005, at 3:58 PM, Christian Lueck wrote:
>
>> ...
>> zope.app.container.interfaces.IAdding seems most promising -- but what
>> to do with it?
>>
>> Question:
>> Is it right to register a formlib-based addview with the
>> <browser:page>-directive?
>
>
> Yep.
>
>> How do I get the + ? ;)
>
>
> The '+' is an implementation of IAdding.  You first need to register 
> the page for the interface, a la
>
>
>   <browser:page class="path.to.your.view.class" name="addWhatever.html"
>            permission="zope.Public"
>            for="zope.app.container.interfaces.IAdding" />
>
> and then register a menu item for the adding that points to it, a la
>
>   <browser:addMenuItem
>       title="Whatever"
>       factory="path.to.your.whatever.factory"
>       permission="zope.Public"
>       view="addWhatever.html"
>       />
>
Cool, that's working fine. Thank you!

> The factory is used to get the interface to check constraints.  You 
> might be able to do without it; check APIdoc if you are curious.

Huh, that means that the '+' is  a kind of global context, or to put it
different:  one can request the addview in arbitrary '+'-contexts, for
example by accessing the url
'/theIntendedContainerForWhatever/+/addWhatever.html' but even by
'/noPlaceForWhatever/+/addWhatever.html'.  There's no exception until a
collision with ContainerTypeConstraints when the factory is called (or
maybe when the object which is returned by the factory is passed to the
add-method (the factory itself seems to have no idea about the context)).


Regards,
Christian


More information about the Zope3-dev mailing list