[CMF-checkins] CVS: CMF/DCWorkflow - DCWorkflow.py:1.15 Worklists.py:1.3
Florent Guillaume
fg@nuxeo.com
Thu, 4 Jul 2002 09:31:12 -0400
Update of /cvs-repository/CMF/DCWorkflow
In directory cvs.zope.org:/tmp/cvs-serv17697/DCWorkflow
Modified Files:
DCWorkflow.py Worklists.py
Log Message:
Made the DCWorkflow worklists accept a list of formatted values for
cataloged variable matches. The separator is a semicolon (Tracker #496).
Added a small 'worklists.stx' documentation file.
Also document the previously-added 'user_id' variable in actbox.stx.
=== CMF/DCWorkflow/DCWorkflow.py 1.14 => 1.15 ===
catalog = getToolByName(self, 'portal_catalog')
dict = {}
- for k, v in qdef.var_matches.items():
- dict[k] = v
+ for k in qdef.var_matches.keys():
+ v = qdef.getVarMatch(k)
+ v_fmt = map(lambda x, info=info: x%info, v)
+ dict[k] = v_fmt
searchres = apply(catalog.searchResults, (), dict)
if not searchres:
continue
=== CMF/DCWorkflow/Worklists.py 1.2 => 1.3 ===
from Guard import Guard
from utils import _dtmldir
+from string import split, strip, join
+StringType = type('')
class WorklistDefinition (SimpleItem):
meta_type = 'Worklist'
@@ -75,9 +77,18 @@
def getVarMatch(self, id):
if self.var_matches:
- return self.var_matches.get(id, '')
+ matches = self.var_matches.get(id, ())
+ if type(matches) is StringType:
+ # Old version, convert it.
+ matches = (matches,)
+ self.var_matches[id] = matches
+ return matches
else:
- return ''
+ return ()
+
+ def getVarMatchText(self, id):
+ values = self.getVarMatch(id)
+ return join(values, '; ')
_properties_form = DTMLFile('worklist_properties', _dtmldir)
@@ -104,7 +115,8 @@
if v:
if not self.var_matches:
self.var_matches = PersistentMapping()
- self.var_matches[key] = str(v)
+ v = map(strip, split(v, ';'))
+ self.var_matches[key] = tuple(v)
else:
if self.var_matches and self.var_matches.has_key(key):
del self.var_matches[key]