[z3-five] Is browser:addMenuItem and addingInfo() supposed to work?

Philipp von Weitershausen philipp at weitershausen.de
Sun Feb 18 13:04:39 CET 2007


Martin Aspeli wrote:
> I've seen reports of people making this work, but I'm struggling. I've 
> got an add view (formlib AddForm) and an add menu item like so:
> 
>      <browser:addMenuItem
>          title="Foo"
>          factory="my.package.Foo"
>          view="my.package.Foo"
>          permission="cmf.AddPortalContent"
>          />
> 
> I then want to list all addable views (in fact, I'm trying to make Plone 
> respect add-menus and ultimately add forms, at least in the case where 
> an add menu item can be linked to an old-fashioned CMF).
> 
> However, I get ComponentLookupErrors, because adding.py in Five does this:
[snip]

Next time, I suggest you paste the error traceback, because that's way 
more informative than a code snippet from Five that everybody can lookup 
by himself. Right now I had to guess what component it failed to lookup...

> Now, neither add_content nor zope.app.container.add is registered 
> anywhere (Products.Five or zope.*) that I can see.

It's registered in zope.app/menus.zcml. This file is probably not 
available in Zope 2 (anymore):

   <menu
       id="zope.app.container.add"
       title="Add"
       description="Menu for objects to be added according to
                    containment constraints"
       interface="zope.app.publisher.interfaces.browser.AddMenu"
       />

> The latter is 
> provided in a test in zope.app.publisher. The former is nowhere to be 
> found. Unless I provide both, I can't see how this won't fail every time.

add_content is old and no longer used in Zope 3.

*Sigh*. This is *exactly* why I want to get rid of all of this useless 
code duplication in Five.

> I can add some registrations in Plone, or send patch to Five if we can 
> get it in time for Plone 3.

For now I suggest you guys register zope.app.container.add yourself. Or, 
perhaps you register a variant and also regsiter your own adding view 
that refers to your variant.


-- 
http://worldcookery.com -- Professional Zope documentation and training
Next Zope 3 training at Camp5: http://trizpug.org/boot-camp/camp5


More information about the z3-five mailing list