Commit 4c10f955 authored by wenjie.zheng's avatar wenjie.zheng

Worklist.py: in updateDynamicVariable, replace slef.var_matched with a...

Worklist.py: in updateDynamicVariable, replace slef.var_matched with a function's attribute, this modification resolve the duplicated listing of variables.
parent ef598466
...@@ -111,6 +111,7 @@ class Worklist(IdAsReferenceMixin("worklist_", "prefix"), XMLObject): ...@@ -111,6 +111,7 @@ class Worklist(IdAsReferenceMixin("worklist_", "prefix"), XMLObject):
def updateDynamicVariable(self): def updateDynamicVariable(self):
# keep worklist variables updating, correspond to workflow variables. # keep worklist variables updating, correspond to workflow variables.
res = []
for variable_value in self.getParentValue().objectValues(portal_type="Variable"): for variable_value in self.getParentValue().objectValues(portal_type="Variable"):
variable_id = variable_value.getId() variable_id = variable_value.getId()
worklist_variable_value = self._getOb(variable_id, None) worklist_variable_value = self._getOb(variable_id, None)
...@@ -120,10 +121,14 @@ class Worklist(IdAsReferenceMixin("worklist_", "prefix"), XMLObject): ...@@ -120,10 +121,14 @@ class Worklist(IdAsReferenceMixin("worklist_", "prefix"), XMLObject):
worklist_variable_value.setReference(variable_value_ref) worklist_variable_value.setReference(variable_value_ref)
worklist_variable_value.setDefaultExpr(variable_value.getDefaultExpr()) worklist_variable_value.setDefaultExpr(variable_value.getDefaultExpr())
worklist_variable_value.setInitialValue(variable_value.getInitialValue()) worklist_variable_value.setInitialValue(variable_value.getInitialValue())
self.var_matches.append(worklist_variable_value) res.append(worklist_variable_value)
elif worklist_variable_value in self.var_matches and variable_value.for_catalog == 0: elif worklist_variable_value not in res and variable_value.for_catalog == 1:
self.var_matches.remove(worklist_variable_value) res.append(worklist_variable_value)
return self.var_matches if worklist_variable_value in res and variable_value.for_catalog == 0:
res.remove(worklist_variable_value)
self._delObject(variable_id)
return res
def getVarMatchKeys(self): def getVarMatchKeys(self):
key_list = [] key_list = []
...@@ -139,7 +144,6 @@ class Worklist(IdAsReferenceMixin("worklist_", "prefix"), XMLObject): ...@@ -139,7 +144,6 @@ class Worklist(IdAsReferenceMixin("worklist_", "prefix"), XMLObject):
def getVarMatch(self, id): def getVarMatch(self, id):
""" return value of matched keys""" """ return value of matched keys"""
self.var_matches = {}
matches = None matches = None
matches_ref_list = [] matches_ref_list = []
if id == 'portal_type': if id == 'portal_type':
......
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