[Zope-CMF] Re: workflow bug

Tres Seaver tseaver@zope.com
Sat, 27 Oct 2001 03:30:52 -0400


seb bacon wrote:

> The use of
> 
>   content_creator = content.Creator()
> 
> in DefaultWorkflow, assumes the object in question implements
> DublinCore, which is a bug IMO, since nowhere else does the Workflow
> assume anything about the object it's passed.  
> 
> I've put a _getCreator method, which is a copy of
> DublinCore.Creator(), in CMFCore.utils.


Hmmm, a couple of things:


 - Workflowable items are assumed to be "content" within CMFDefault's

    DefaultWorkflow, and "content" is assumed to implement the DublinCore
    interface.  What objects are failing for you here?

  - I think your '_getCreator' function probably belongs in
    CMFDefault.DefaultWorkflow, rather than in CMFCore, as it encodes a
    knowledge of the default implementation of Creator which may not
    apply everywhere (e.g., we already know that mapping "executable
    ownership" onto Creator is inflexible, and often bogus, and might
    like to fix that.)

  - I just looked at how the workflow is using Creator, and it "smells
    bad":  Creator is used only to allow the "reject" action,
    if the user is owner;  this should really be a permission check,
    or at least a role check (for the 'Owner' local role, rather than
    for "executable ownership").

Could you use a DCWorkflow instead to solve your problem?  It does
the Right Thing (tm) about guarding transitions with permissions or
roles, I think.

Tres.
-- 
===============================================================
Tres Seaver                                tseaver@zope.com
Zope Corporation      "Zope Dealers"       http://www.zope.com