[Zope-CMF] Newbie Q: create document w/o specifying metadata?

Tres Seaver tseaver@palladion.com
Mon, 13 Aug 2001 21:25:34 -0400


davelehman@loewen.com wrote:

> Thanks for the help!
> 
> That seems to work-- but I'm still not quite understanding the whole
> process.
> 
> I've created a new type called "story" based on a CMF Document. I'm calling
> "story_edit_form" directly as the "initial view name". I have modified the
> "title" and "description" field on the "story_edit_form" to be editable.
> But, when I make changes to the form and hit the "submit" button, only the
> "edit" field reflects the changes-- the "title" and "description" fields
> are still blank.
> 
> I tried changing the "story_edit" script as follows to include the title
> and description fields, but I obviously don't understand what i'm doing.
> Any suggestions?
> 
> --dave
> 
> 
> - - - -
> parameters: title, description, text_format, text, file='', SafetyBelt=''
> 
> context.edit(title,
>              description,
>              text_format,
>              text,
>              file,
>              safety_belt=SafetyBelt)
> 
> qst='?portal_status_message=Story+changed.'
> 
> context.REQUEST.RESPONSE.redirect( context.absolute_url() +
> '/story_edit_form' + qst )

The 'edit' method of CMFDefault's Document doesn't take 'title'
or 'description' arguments.  You should be able to set them
individually using methods from the MutableDublinCore interface,
something like:


   context.edit( text_format, text, file, safety_belt=SafetyBelt )
   context.setTitle( title )
   context.setDescription( description )

   qst='?portal_status_message=Story+changed.'

   context.REQUEST.RESPONSE.redirect( context.absolute_url() +
                    '/story_edit_form' + qst )


Tres.
-- 
===============================================================
Tres Seaver                                tseaver@zope.com
Zope Corporation      "Zope Dealers"       http://www.zope.com