[Zope-CMF] Add forms and menus
Martin Aspeli
optilude at gmx.net
Fri Jul 11 19:35:24 EDT 2008
Hi folks,
I see that Yuppie has been experimenting with add forms. From what I can
tell, he's using a custom formlib base class and registering views as
e.g. addFile.html. It also look as if he's registering that view as an
action in portal_actions, in the 'folder' category.
Plone currently supports add forms for the IAdding (+) view in a
somewhat ugly way (it looks to see if there's a view for IAdding with
the same name as the 'factory' set in the FTI of an addable type, and if
so, provides a link to it). IAdding can be a bit painful, so we're
interested in supporting an approach based on simple views.
It's also worth noting that z3c.form (via plone.z3cform, which should be
plain CMF compatible, though you may want a different default template)
has support for such views in quite a generic way. The "CMF" version of
that looks like this:
http://dev.plone.org/plone/browser/plone.z3cform/trunk/plone/z3cform/add.py
z3c.form is generally nicer to work with than formlib.
In any case, I'd like to know why you went down the portal_actions route
for rendering the add links. I'm not quite sure I like the idea of
having this be persistent configuration, separate to the FTI, as the two
would need to be kept in sync, and in sync with the view name registered
in ZCML.
Also, why not try to use the Zope 3 menu concept? There's even a special
"add menu" directive.
I'd quite like to find a good approach here that can be used by both
Plone and plain CMF, if possible.
Cheers,
Martin
--
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