[Zope-PTK] CMF Dogbowl: workflow Proposal

Shane Hathaway shane@digicool.com
Tue, 20 Mar 2001 13:49:56 -0500


Kent Polk wrote:
> 
> On 19 Mar 2001 20:35:00 -0600, Shane Hathaway wrote:
> >
> >> >So, if the default workflow doesn't quite fit, the intention is that you
> >> >replace or subclass DefaultWorkflow.  That doesn't mean you need to
> >> >change CMFCore, but until the WorkflowTool is folderish, it does mean
> >> >you need to make your own WorkflowTool.
> >>
> >> I'm working on it. :^)
> >
> >I'm glad to hear you're getting into it.
> 
> Few Questions...
> 
> I've mapped
> DefaultWorkflow.py        WorkflowCore.py        WorkflowTool.py
> into
> RequestWorkflow.py RequestWorkflowCore.py RequestWorkflowTool.py
> and added RequestWorkflowTool.WorkflowTool to __init__ tools
> 
> I changed the id's in RequestWorkflow.py & RequestWorkflowTool.py
> and the meta_type in RequestWorkflowTool.

I suggest you do not rename portal_workflow.  Its name is part of its
interface.

The only thing you need in RequestWorkflowTool.py is something like
this:

class RequestWorkflowTool(WorkflowTool):
    default_workflow = RequestWorkflow()

Or perhaps more focused:

class RequestWorkflowTool(WorkflowTool):
    request_workflow = RequestWorkflow()

    def getDefaultChainFor(self, ob):
        if getattr(ob, '_isPortalContent', 0):
            if ob.getTypeInfo().id == 'Request':
                return ('request_workflow',)
            else:
                return self._default_chain
    
Maybe it's time to just make it into a folder, though...

> I added a getRecipientOf() to RequestWorkflow.py which hopefully
> extracts the recipient values from the request objects, and included
> 'recipient': self.getRecipientOf(ob) in the getCatalogVariablesFor
> dictionary.

You can make getRecipientOf() accessible by DTML by making it available
through getInfoFor(), which searches through the available workflows
until it finds something that can provide the requested information.

> So it appear that getToolByName() isn't picking up the correct
> tool.  Any ideas on what I missed? Does the rest of the stuff
> look reasonable?

It sounds reasonable, though I'm not sure why you need a
RequestWorkflowCore.  What's different there?

Shane