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

davelehman@loewen.com davelehman@loewen.com
Wed, 8 Aug 2001 16:17:17 -0500


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 )
- - - -


On 08/07/2001 07:13:59 AM Tres Seaverwrote:

>davelehman@loewen.com wrote:
>
>> I have created a CMF site for our church intranet. I would like to
create a
>> button on one of my portal pages called "Post Story" which will allow
>> members to post items by themselves. Basically, it will just create a
new
>> "document" item.
>>
>> However, i would like to just skip the "metadata_edit_form" page
(because I
>> think it's confusing and unintuitive for the unwashed masses) and go
>> directly to the "edit_document_form". It must be easy to do this, but I
>> can't figure out how. My first thought was to create a python script
that
>> would create an ID (probably based on ZopeTime?) and supply dummy
metadata
>> and then call the edit_document_form directly.
>>
>> I'm sure this must be easy, but on behalf of the clueless newbies in the
>> bunch, could I get a little help on this one?
>
>You have a couple of options here:
>
>
>  - Configure the 'Document' type object's "Initial view" property
>    to point to 'document_edit_form', instead of 'metadata_edit_form';
>
>  - Write a script as you suggested;  something like (untested)::
>
>      ts = int( context.ZopeTime().time_t() )
>      id = 'story_%d' % ts
>      context.invokeFactory( id=id, type_name='Document' )
>      story = getattr( context, id )
>      context.REQUEST['RESPONSE'].redirect( '%s/document_edit_form'
>                                          % story.absolute_url() )
>
>You might also consider unifying the two forms, and look at using
>the metadata tool to restrict the vocabulary for the "Subject" field.
>
>Tres.
>--
>===============================================================
>Tres Seaver                                tseaver@zope.com
>Zope Corporation      "Zope Dealers"       http://www.zope.com
>