Commit ad093324 authored by wenjie.zheng's avatar wenjie.zheng

testWorklist.py: add new workflow compatibility.

parent ac8896f4
......@@ -153,22 +153,49 @@ class TestWorklist(ERP5TypeTestCase):
self._addPropertySheet(self.checked_portal_type, 'SortIndex')
def addWorkflowCataloguedVariable(self, workflow_id, variable_id):
variables = self.getWorkflowTool()[workflow_id].variables
variables.addVariable(variable_id)
assert variables[variable_id].for_catalog == 1
# add new workflow compatibility
workflow_value = self.getWorkflowTool()[workflow_id]
if workflow_value.__class__.__name__ == 'Workflow':
variable_value = workflow_value.newContent(id='variable_'+variable_id,
portal_type='Variable')
variable_value.setReference(variable_id)
else:
variables = workflow_value.variables
variables.addVariable(variable_id)
variable_value = variables[variable_id]
assert variable_value.for_catalog == 1
def createWorklist(self, workflow_id, worklist_id, actbox_name,
actbox_url=None, **kw):
worklists = self.getWorkflowTool()[workflow_id].worklists
worklists.addWorklist(worklist_id)
worklists._getOb(worklist_id).setProperties('',
# add new workflow compatibility
workflow_value = self.getWorkflowTool()[workflow_id]
if workflow_value.__class__.__name__ == 'Workflow':
worklist_value = workflow_value.newContent(portal_type='Worklist')
worklist_value.setReference(worklist_id)
worklist_value.setProperties('',
actbox_name='%s (%%(count)s)' % actbox_name, actbox_url=actbox_url,
props={k if k.startswith('guard_') else 'variable_' + k: v
for k, v in kw.iteritems()})
worklist_value.updateDynamicVariable()
else:
worklists = workflow_value.worklists
worklists.addWorklist(worklist_id)
worklist_value = worklists._getOb(worklist_id)
worklist_value.setProperties('',
actbox_name='%s (%%(count)s)' % actbox_name, actbox_url=actbox_url,
props={k if k.startswith('guard_') else 'var_match_' + k: v
for k, v in kw.iteritems()})
def removeWorklist(self, workflow_id, worklist_id_list):
worklists = self.getWorkflowTool()[workflow_id].worklists
worklists.deleteWorklists(worklist_id_list)
# add new workflow compatibility
workflow_value = self.getWorkflowTool()[workflow_id]
if workflow_value.__class__.__name__ == 'Workflow':
for worklist_id in worklist_id_list:
workflow_value._delObject('worklist_'+worklist_id)
else:
worklists = self.getWorkflowTool()[workflow_id].worklists
worklists.deleteWorklists(worklist_id_list)
def createWorklists(self):
for worklist_id, actbox_name, role, expr, state, int_variable in [
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment