[Zope-CMF] Re: Add forms and menus

Martin Aspeli optilude at gmx.net
Wed Jul 16 07:36:16 EDT 2008


yuppie <y.2008 at ...> writes:
 
> > class MyAddForm(CMFBaseAddForm):
> >     fields = form.Fields(IMyType)
> >     portal_type = 'My type'
> 
> Here you are mixing up content type with portal type. We can't hardcode 
> the portal type if we want to use the add form for renamed/derived 
> portal types as well.

Right, sorry. We probably don't need this at all, actually, if the
traverser sets it along with the factory name.

> >  - The base form knows to look at self.factory_name to look up the 
> > factory when it does the create() call.
> 
> create() needs to know the portal type, not just the factory name.

Okay, sure, but that's known at this stage too if the traverser saves it.

> Above you wanted to use self.factory_name inside the form, now you set 
> addview.portal_type.
>
> We definitely have to pass the portal type to the view. If we have to 
> look up the factory name in publishTraverse, we might want to pass it to 
> the view as well.

Right.

Martin



More information about the Zope-CMF mailing list