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

Workflow.py: fix getCatalogVariablesFor not returning initial_state correctly error.

parent a860e63f
...@@ -1075,7 +1075,10 @@ class Workflow(IdAsReferenceMixin("", "prefix"), XMLObject): ...@@ -1075,7 +1075,10 @@ class Workflow(IdAsReferenceMixin("", "prefix"), XMLObject):
Returns a mapping containing the catalog variables Returns a mapping containing the catalog variables
that apply to ob. that apply to ob.
''' '''
initial_state = None
res = {} res = {}
# Always provide the state variable.
state_var = self.getStateVariable()
status = self.getCurrentStatusDict(ob) status = self.getCurrentStatusDict(ob)
for id, vdef in self.getVariableValueList().iteritems(): for id, vdef in self.getVariableValueList().iteritems():
if vdef.for_catalog: if vdef.for_catalog:
...@@ -1088,17 +1091,12 @@ class Workflow(IdAsReferenceMixin("", "prefix"), XMLObject): ...@@ -1088,17 +1091,12 @@ class Workflow(IdAsReferenceMixin("", "prefix"), XMLObject):
value = vdef.default_expr(ec) value = vdef.default_expr(ec)
else: else:
value = vdef.default_value value = vdef.default_value
res[id] = value res[id] = value
# Always provide the state variable. if hasattr(self, 'getSourceValue'):
state_var = self.getStateVariable()
if state_var is not None:
res[state_var] = status[state_var]
elif hasattr(self, 'getSourceValue'):
if self.getSourceValue() is not None: if self.getSourceValue() is not None:
res[state_var] = self.getSourceValue().getReference() initial_state = self.getSourceValue().getReference()
else: if state_var is not None:
res[state_var] = None res[state_var] = status.get(state_var, initial_state)
return res return res
def Guard_checkWithoutRoles(self, sm, wf_def, ob, **kw): def Guard_checkWithoutRoles(self, sm, wf_def, ob, **kw):
......
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