[Zope-CMF] Re: Stuck with DCWorkflow....
Riccardo Lemmi
riccardo@reflab.it
Fri, 30 May 2003 17:21:23 +0200
Dmitry S. Makovey wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
>
> Hi, I'm stuck with DCWorkflow and looking for enlightenment ;)
>
> I'm working with plone, but i suppose it shouldn't make much difference.
>
> I'm trying to create a new state : archive. Scenario is as follows:
> whenever item is get published it should be copied over to an archive.
> Items in archive should have their own state "archive", and published item
> remains published.
> My steps:
> 1. copied over folder_workflow (I know I should've used plone_workflow but
> for the sake of simplicity I'll stay with it for awhile) to dimon_workflow
> 2. in dimon workflow:
> created new state: archive (no possible transition from that state)
> in dimon_workflow created script:
> <archiveOnPublish.py>
> o=getattr(state_change, 'object')
> obj_parent=o.aq_parent
> portal_root=context.portal_url.getPortalObject()
> wf_tool=portal_root.portal_workflow
>
> dest_name=getattr(portal_root,'archive')
> archive=getattr(portal_root,dest_name)
> ac=archive.manage_pasteObjects( obj_parent.manage_copyObjects(o.getId())
> )
>
> workflow_action='copy_to_archive'
> comment='Auto-archived'
> for o in ac:
> a=getattr(archive,o['new_id'])
> wf_tool.doActionFor( a, workflow_action)
> </archiveOnPublish.py>
> created new transition copy_to_archive (Destination: archive, initiated
> by
> workflow method)
> modified "publish" transition to run archiveOnPublish after transition
> modified "published" state to allow copy_to_archive transition
> changed private state to allow transition to archive state (copy_t
> Associated dimon_workflow with Course type
> Now whenever I'm trying to "publish" Course I get:
>
> <Error message>
> Error Type
> WorkflowException
>
> Error Value
> No workflow provides the "copy_to_archive" action.
> </Error message>
> ...
When a content is pasted the status of copied object is 'visible'.
You shouldst add a transition from 'visible' to 'archive', and the 'Trigger
type' should be 'Initiated by user action'.
--
Riccardo Lemmi