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

Tres Seaver tseaver@palladion.com
Tue, 07 Aug 2001 08:13:59 -0400


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