Laurence Rowe wrote:
yuppie wrote:
The lookup is pretty much what I do at the moment. I can't think of an easy way of doing this apart from convention which is pretty much what you suggest with "addFile". I suppose the next thing would be to add support for the '+' syntax and addMenuItem directive?

The IAdding view ('+' syntax) and Zope 3 menus are special code for the Zope 3 app ZMI. I don't plan to add support for that.

FWIW, in Plone we rely on the adding view.

Quoting http://svn.zope.org/*checkout*/z3c.form/trunk/src/z3c/form/adding.txt?rev=78513 :

"While using ``IAdding``-based add forms is strongly discouraged by this
package due to performance and code complexity concerns, there is still the
need for add forms based on IAdding, especially when one wants to extend the
default ZMI and use the add menu."

If Zope 3 people strongly discourage using IAdding, I don't see a good reason why we should use it in Zope 2.

If a new style factory is specified in the FTI a view of that name is looked up on the adding view of the container. This is from plone.app.contentmenu.menu.FactoriesSubMenuItem:

addingview = queryMultiAdapter((addContext, self.request), name='+')
if addingview is not None:
addview = queryMultiAdapter((addingview, self.request), name=fti.factory)
    if addview is not None:
        return '%s/+/%s' % (baseUrl, fti.factory,)

That means view name and factory name have to be the same. The portal type is not passed to the view, so it has to be hardcoded inside the view. Not very flexible, but if factory and view are only used for one hardcoded portal type it works.



Zope-CMF maillist  -  Zope-CMF@lists.zope.org

See http://collector.zope.org/CMF for bug reports and feature requests

Reply via email to