[Zope-CMF] DCWorkflow enhancement patch: Worklist specs

Stephen Bartlett stephen@bartlettsoftware.biz
Thu, 26 Jun 2003 16:13:21 -0700


=2D----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

In using DCWorkflow 0.4.2, I found this patch to DCWorkflow.py to be useful.

It is a backward-compatible enhancement to listGlobalActions() that allows=
=20
you to use expression variables in Worklist specifications (the "Cataloged=
=20
variable matches" fields) rather than just literal values. The practical up=
shot=20
for me was it allowed me to filter on user_id, thereby achieving per-user=20
worklists.

I also posted this on http://cmf.zope.org/Members/sbart17

=2D - Stephen

=2D --=20
Stephen Bartlett, President
Bartlett Software, Inc.
http://www.bartlettsoftware.biz/

=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D
*** DCWorkflow.py	2001-11-28 11:06:27.000000000 -0800
=2D --- /usr/local/zope/2.6.1/lib/python/Products/DCWorkflow/DCWorkflow.py	=
2003-06-25 14:38:29.000000000 -0700
***************
*** 213,230 ****
                  guard =3D qdef.guard
                  if guard is None or guard.check(sm, self, portal):
                      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, (), di=
ct)
                          if not searchres:
                              continue
=2D -                     if fmt_data is None:
=2D -                         fmt_data =3D TemplateDict()
=2D -                         fmt_data._push(info)
                      searchres_len =3D lambda searchres=3Dsearchres: len(s=
earchres)
                      fmt_data._push({'count': searchres_len})
                      res.append((id, {'name': qdef.actbox_name % fmt_data,
=2D --- 213,230 ----
                  guard =3D qdef.guard
                  if guard is None or guard.check(sm, self, portal):
                      searchres =3D None
+                     if fmt_data is None:
+                         fmt_data =3D TemplateDict()
+                         fmt_data._push(info)
                      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 % fmt_data
                          searchres =3D apply(catalog.searchResults, (), di=
ct)
                          if not searchres:
                              continue
                      searchres_len =3D lambda searchres=3Dsearchres: len(s=
earchres)
                      fmt_data._push({'count': searchres_len})
                      res.append((id, {'name': qdef.actbox_name % fmt_data,
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D
=2D----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.1 (GNU/Linux)

iD8DBQE++34YR7d3GIt7UjgRAostAJ9Q/G7+hRMCJ2P2hZbEuCDlnBAGPwCgg2gM
K7pmG7nUR6G16NGnPvW1fhw=3D
=3DFdcp
=2D----END PGP SIGNATURE-----