[Zope-CMF] How to add a non-empty instance of a content type

Sam Brauer sam@webslingerz.com
Tue, 10 Jun 2003 10:51:50 -0400


I'm pretty new to CMF, but have figured out how to add/change 
functionality by customizing the skins, and have written some new
types as Python products.  However, there is an issue that's been 
nagging at me that I haven't been able to sort out yet.

The way the CMF UI works by default, you add a new object by selecting 
its type and providing an ID, then it creates a new object (storing it 
in the current folder), then presents you with the metadata form.

I know you can change the "immediate view" to the edit form instead of 
the metadata form.  But what I'd really like to be able to do is present 
the user with a customized version of the edit form that includes an ID 
field, and not actually store an object until the user submits the edit 
form.  At that time, besides doing any type-specific validation, I would 
need to make sure that the ID is valid.  Then if there's anything 
invalid, I would re-render the edit form with the data from the request 
and some error messages.

My custom types can do the validation and form re-rendering, but they 
can only edit existing objects.  My types have a factory method that 
takes as arguments an ID and an optional REQUEST.  I'm guessing there's 
some way a script could call that constructor method and pass a REQUEST 
to it, but I haven't been able to figure out the proper way to do that yet.

Can anyone offer any advice on handling an "add" form that doesn't store 
a new object until the add form has been successfully submitted?

Many thanks
Sam
-- 
Sam Brauer
Systems Programmer
sam@webslingerZ.com