Hi Marius
> Betreff: Re: [Zope3-Users] z3c.form and subforms in an AddForm?
> On Fri, Jun 15, 2007 at 10:52:24AM -0700, gnosis wrote:
> > I've been trying out the new z3c form package and like what 
> I see.  I 
> > am having problems getting a subform in an AddForm though.  The 
> > subform.txt covers EditForms where you have a context 
> object to work 
> > on, in an AddForm the context is the underlying IContainer.
> Really?  Usually in Zope 3 (zope.app.form or zope.formlib) 
> the context of an add form is the IAdding view.  To get the 
> container you have to use self.context.context.

I never use add forms on top of a IAdding form. I also never
use the folder contraints for this. The lookup methods for 
get items based on the constraints are to slow.

I simply register viewlets on containers which will generate
add form links. The add form itself is registred for the
container and will add the them. there is no need for the
complex and slow IAdding view pattern.

The newest improvments on this is that there is a provides
attribute in the pagelet directive. This allows you to 
provide e.g. IAddForm for a pagelet. Such pagelet can you
get from the adapter registry. This means the add form is
registred with the container as a part of the adapter 
registry discriminator. This is the fastest way for get 
add forms.


Right now that's restricted to the z3c:pagelet pattern.
I guess I have to write new addform and editform directives
for the new z3c.form package, which whould make it possible
to use the same pattern for pages instead of pagelets.

PS, we just use pagelets and not pages anymore in our 
projects. They are much more flexible and offer macro
less html. See z3c/website/skin/template.pt

Roger Ineichen

Zope3-users mailing list

Reply via email to