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

Worklist.py: getVarMatchedKey won't add key portal_type server times now;...

Worklist.py: getVarMatchedKey won't add key portal_type server times now; getVarMatched retruns matche values for one key each time.
parent 9a683699
......@@ -118,14 +118,13 @@ class Worklist(IdAsReferenceMixin("worklist_", "prefix"), XMLObject):
def getVarMatchKeys(self):
key_list = []
if self.getMatchedSimulationState() is not None:
if self.getMatchedPortalType is not None:
key_list.append('portal_type')
if self.getMatchedSimulationState() is not None:
key_list.append('simulation_state')
if self.getMatchedValidationState() is not None:
key_list.append('portal_type')
key_list.append('validation_state')
if self.getMatchedCausalityState() is not None:
key_list.append('portal_type')
key_list.append('causality_state')
return key_list
......@@ -135,28 +134,31 @@ class Worklist(IdAsReferenceMixin("worklist_", "prefix"), XMLObject):
matches = None
matches_ref_list = []
if id == 'portal_type':
matches = self.getMatchedPortalTypeList()
if id in ['validation_state', 'simulation_state']:
v = ''.join(self.matched_portal_type)
if tales_re.match(v).group(1):
matches = Expression(v)
else:
v = [ var.strip() for var in self.matched_portal_type ]
matches = tuple(v)
elif id in ['validation_state', 'simulation_state']:
if id == 'validation_state':
matches_id_list = self.getMatchedValidationStateList()
elif id == 'simulation_state':
matches_id_list = self.getMatchedSimulationStateList()
for state_id in matches_id_list:
matches_ref_list.append(self.getParent()._getOb(state_id).getReference())
matches = matches_ref_list
if id == 'causality_state':
matches = tuple(matches_ref_list)
elif id == 'causality_state':
matches_id = self.getMatchedCausalityState()
if matches_id is None:
matches_id = ''
matches_ref_list.append(matches_id)
matches = matches_ref_list
matches = tuple(matches_ref_list)
if matches is not None:
if matches is not []:
if not isinstance(matches, (tuple, Expression)):
# Old version, convert it.
matches = (matches,)
matches = tuple(matches)
return matches
else:
return ()
......
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