[Zope-CMF] DCWorkflow and list object/global actions

Jostein Leira jostein.leira@creuna.no
Fri, 15 Feb 2002 16:15:32 +0100


I have a problem with DCWorkflow and worklists. The method =
DCWorkflowDefinition.listGlobalActions() (in DCWorkflow.py) returns =
actions in the category "object" from other workflows worklists. Can =
this be correct?

Example:
Document type A with workflow containing no worklists.
Document type B with workflow containing a history worklist in category =
"object".

Calling A.listGlobalActions() returns the "history" worklist. (From a =
DTML method actually calling <dtml-let =
actions=3D"portal_actions.listFilteredActionsFor(this().aq_explicit)"> =
that again is calling A.listGlobalActions())

Possible first step to a solution:
On line 283-284 of DCWorkflow.py (Revision 1.12):

  for id, qdef in self.worklists.items():
    if qdef.actbox_name:

Replace with this:

  for id, qdef in self.worklists.items():
    if qdef.actbox_name and qdef.actbox_category=3D=3D"global":

This works fine, but then I get the problem that B.listObjectActions() =
does not return the "history" worklist. After inspecting the =
listObjectActions() method I can't see any reference to the objects =
worklists.

Inserted the following code on line 266 of DCWorkflow.py:

        fmt_data =3D None
        for id, qdef in self.worklists.items():
            if qdef.actbox_name and qdef.actbox_category=3D=3D"object":
                guard =3D qdef.guard
                if guard is None or guard.check(sm, self, =
self._getPortalRoot()):
                    searchres =3D None
                    if qdef.var_matches:
                        # Check the catalog for items in the worklist.
                        catalog =3D getToolByName(self, =
'portal_catalog')
                        dict =3D {}
                        for k, v in qdef.var_matches.items():
                            dict[k] =3D v
                        searchres =3D apply(catalog.searchResults, (), =
dict)
                        if not searchres:
                            continue
                    if fmt_data is None:
                        fmt_data =3D TemplateDict()
                        fmt_data._push(info)
                    searchres_len =3D lambda searchres=3Dsearchres: =
len(searchres)
                    fmt_data._push({'count': searchres_len})
                    res.append((id, {'name': qdef.actbox_name % =
fmt_data,
                                     'url': qdef.actbox_url % fmt_data,
                                     'permissions': (),  # =
Predetermined.
                                     'category': qdef.actbox_category}))
                    fmt_data._pop()

This seems to do the trick. Any comments? What about actions in other =
categories than "object" and "global"?

Regards



Jostein Leira


Jostein Leira
phone: (+47) 982 38 051
mailto:jostein.leira@creuna.no

Creuna as
Bryggegata 3
NO-0250 Oslo

phone office: (+47) 23 23 88 00
fax: (+47) 23 23 88 50=20
http://www.creuna.no