[Zope-CMF] workflow_tool

Alan Runyan runyaga@runyaga.com
Tue, 12 Feb 2002 18:08:46 -0600


Q: I have a install script that is run in CMF.  It needs to associate
workflows to all the content in the portal.  I do this

    rootObj=self.aq_parent.restrictedTraverse( ('',) )
    control_panel = getattr(rootObj, 'Control_Panel', None)
    if control_panel:
        products=control_panel.Products
        if not hasattr(products, 'DCWorkflow'):
            outStream.write('You do not have DCWorkflow installed.  it is
*highly* recommended you install it.\n')
        else:
            wf_tool=getToolByName(self, 'portal_workflow')
            wf_tool.manage_addWorkflow(id='plone_workflow',
workflow_type='default_workflow (Web-configurable workflow [Revision 2])')

            wf_tool.setDefaultChain('plone_workflow')
            portal_tool=getToolByName(self, 'portal_url')
            portal=portal_tool.getPortalObject()
            portal.invokeFactory(type_name='Document', id='welcome')
            no_affected=wf_tool.updateRoleMappings()
    else:
        outStream.write('could not access Root object.\n')

no matter what I do I can not get updateRoleMappings() to work.  do I have
to manually create Users?  or how do I createMemberArea with the current
persons ID?  it would go:

create CMF site -> run install script.
(createMemberArea(self.REQUEST.AUTHENTICATED_USER.getUserName())
and then I would create a test document, and the nrun updateRoleMappings?

thanks,
~runyaga