[Zope-CMF] DCWorkflow: trouble with Guard expressions

Jens Quade jq@jquade.de
08 Jun 2001 18:14:23 +0200


Hi,

I'm having trouble using the Guard expression in DCWorkflow 0.2.
Everything else works fine; it's a great product.

It seems that in Guard.py's check method 
expr() is called with too much parameters. I fixed this,
but then I got no variables to use in my expression.

I think the call to expr() in the check() method in Guard.py 
has to be changed to a call to something equivalent to exprNamespace,
but without the status change environment. To try this, I
modified the if expr...: block in check() to look like this:

        if expr is not None:

            md = TemplateDict()
            md._push(ExprVars(ob, wf_def))
            d = {'object': ob,
                 'workflow': wf_def,
                 }
            md._push(d)
            md._push(wf_def.scripts)  # Make scripts automatically available.
            
            res = expr(md) 
            if not res:
                return 0

I do not really know what I'm doing there... but it works :)

Another suggestion: It would be nice to have a portal object in the
namespace: I often use e.g. object.portal_membership as workaround,
but with portal.portal_membership it would be clearer what I'd like to
do..


jens


-- 
Shipping software is an unnatural act