Commit 43faaf31 authored by iv's avatar iv

ERP5Workflow: rename variable default_expr to default_expression

parent 1b2aa5d6
......@@ -140,7 +140,7 @@ class InteractionWorkflow(IdAsReferenceMixin("", "prefix"), Workflow):
getSecurityManager(), self, ob):
return default
status = self._getStatusOf(ob)
default_expr = vdef.getDefaultExpr()
default_expr = vdef.getDefaultExpression()
if status is not None and name in status:
value = status[name]
# Not set yet. Use a default.
......@@ -280,7 +280,7 @@ class InteractionWorkflow(IdAsReferenceMixin("", "prefix"), Workflow):
# Preserve former value
value = former_status[id]
else:
default_expr = vdef.getDefaultExpr()
default_expr = vdef.getDefaultExpression()
if default_expr is not None:
expr = Expression(default_expr)
else:
......
......@@ -66,13 +66,6 @@ class Variable(IdAsReferenceMixin("variable_", "prefix"), XMLObject):
PropertySheet.Variable,
)
def getDefaultExprText(self):
default_expr = self.getDefaultExpr()
if not default_expr:
return ''
else:
return default_expr
def getInfoGuardSummary(self):
res = None
if self.getGuard() is not None:
......@@ -99,4 +92,4 @@ class Variable(IdAsReferenceMixin("variable_", "prefix"), XMLObject):
if self.getGroupList() is not None:
self.info_guard.groups = self.getGroupList()
if self.getExpression() is not None:
self.info_guard.expr = Expression(self.getExpression())
\ No newline at end of file
self.info_guard.expr = Expression(self.getExpression())
......@@ -429,7 +429,7 @@ class Workflow(IdAsReferenceMixin("", "prefix"), XMLObject):
getSecurityManager(), self, ob):
return default
status = self.getCurrentStatusDict(ob)
default_expr = vdef.getDefaultExpr()
default_expr = vdef.getDefaultExpression()
if status is not None and status.has_key(name):
value = status[name]
......@@ -647,7 +647,7 @@ class Workflow(IdAsReferenceMixin("", "prefix"), XMLObject):
if tdef is not None:
transition_variable_list = tdef.objectValues(portal_type='Transition Variable')
for transition_variable in transition_variable_list:
tdef_exprs[transition_variable.getCausalityId()] = transition_variable.getDefaultExpr()
tdef_exprs[transition_variable.getCausalityId()] = transition_variable.getDefaultExpression()
# Update all transition variables
if form_kw is not None:
......@@ -668,8 +668,8 @@ class Workflow(IdAsReferenceMixin("", "prefix"), XMLObject):
# Preserve former value
value = former_status[variable_reference]
else:
if vdef.getDefaultExpr() is not None:
expr = vdef.getDefaultExpr()
if vdef.getDefaultExpression() is not None:
expr = vdef.getDefaultExpression()
else:
value = vdef.getInitialValue(object=object)
if expr is not None and expr != '':
......@@ -895,7 +895,7 @@ class Workflow(IdAsReferenceMixin("", "prefix"), XMLObject):
for tr_var in tr_var_list:
reference = self._getOb(tr_var.getCausalityId()).getReference()
transition_variable = SubElement(transition_variables, property_id, attrib=dict(id=reference,type='variable'))
transition_variable.text = str(tr_var.getDefaultExpr())
transition_variable.text = str(tr_var.getDefaultExpression())
else:
property_value = tdef.getProperty(property_id)
property_type = tdef.getPropertyType(property_id)
......@@ -1068,7 +1068,7 @@ class Workflow(IdAsReferenceMixin("", "prefix"), XMLObject):
# Preserve former value
value = former_status[id]
else:
default_expr = vdef.getDefaultExpr()
default_expr = vdef.getDefaultExpression()
if default_expr is not None:
expr = Expression(default_expr)
else:
......@@ -1120,7 +1120,7 @@ class Workflow(IdAsReferenceMixin("", "prefix"), XMLObject):
status = self.getCurrentStatusDict(ob)
for vdef_ref, vdef in self.getVariableValueDict().iteritems():
if vdef.getForCatalog():
default_expr = vdef.getDefaultExpr()
default_expr = vdef.getDefaultExpression()
if status.has_key(vdef_ref):
value = status[vdef_ref]
......
......@@ -144,7 +144,7 @@ class Worklist(IdAsReferenceMixin("worklist_", "prefix"), XMLObject):
variable_value_ref = variable_value.getReference()
worklist_variable_value = self.newContent(portal_type='Worklist Variable')
worklist_variable_value.setReference(variable_value_ref)
worklist_variable_value.setDefaultExpr(variable_value.getDefaultExpr())
worklist_variable_value.setDefaultExpression(variable_value.getDefaultExpression())
worklist_variable_value.setInitialValue(variable_value.getInitialValue())
res.append(worklist_variable_value)
if worklist_variable_value and worklist_variable_value not in res and variable_value.getForCatalog() == 1:
......@@ -174,7 +174,7 @@ class Worklist(IdAsReferenceMixin("worklist_", "prefix"), XMLObject):
if self.getMatchedCausalityState() is not None:
key_list.append('causality_state')
for dynamic_variable in self.objectValues():
if dynamic_variable.getInitialValue() or dynamic_variable.getDefaultExpr():
if dynamic_variable.getInitialValue() or dynamic_variable.getDefaultExpression():
key_list.append(dynamic_variable.getReference())
return key_list
......@@ -206,8 +206,8 @@ class Worklist(IdAsReferenceMixin("worklist_", "prefix"), XMLObject):
if dynamic_varible.getInitialValue():
matches = [dynamic_varible.getInitialValue()]
# Override initial value if expression set:
if dynamic_varible.getDefaultExpr():
matches = Expression(dynamic_varible.getDefaultExpr())
if dynamic_varible.getDefaultExpression():
matches = Expression(dynamic_varible.getDefaultExpression())
if matches is not [] and matches is not None:
if not isinstance(matches, (tuple, Expression)):
......
......@@ -64,10 +64,3 @@ class WorklistVariable(IdAsReferenceMixin("variable_", "prefix"), XMLObject):
PropertySheet.Reference,
PropertySheet.Variable,
)
def getDefaultExprText(self):
default_expr = self.getDefaultExpr()
if not default_expr:
return ''
else:
return default_expr
......@@ -411,7 +411,7 @@ class WorkflowTool(BaseTool, OriginalWorkflowTool):
worklist_variable_value = worklist.newContent(portal_type='Worklist Variable')
worklist_variable_value.setReference(key)
if isinstance(values, Expression):
worklist_variable_value.setDefaultExpr(values.text)
worklist_variable_value.setDefaultExpression(values.text)
else:
worklist_variable_value.InitialValue(value)
worklist.setActboxUrl(qdef.actbox_url)
......@@ -509,8 +509,8 @@ class WorkflowTool(BaseTool, OriginalWorkflowTool):
# for a very specific case, action return the reference of transition
# in order to generation correct workflow history.
if vid == 'action':
variable.setDefaultExpr('transition/getReference|nothing')
else: variable.setDefaultExpr(vdef.default_expr.text)
variable.setDefaultExpression('transition/getReference|nothing')
else: variable.setDefaultExpression(vdef.default_expr.text)
if vdef.info_guard:
variable.info_guard = vdef.info_guard
variable.setRoleList(vdef.info_guard.roles)
......@@ -535,7 +535,7 @@ class WorkflowTool(BaseTool, OriginalWorkflowTool):
else: var_exprs = origin_tdef.var_exprs
for key in var_exprs:
tr_var = transition.newContent(portal_type='Transition Variable', temp_object=temp)
tr_var.setDefaultExpr(var_exprs[key].text)
tr_var.setDefaultExpression(var_exprs[key].text)
tr_var_path = getattr(workflow, 'variable_'+key).getPath()
tr_var_path = '/'.join(tr_var_path.split('/')[2:])
new_category.append(tr_var_path)
......@@ -552,7 +552,7 @@ class WorkflowTool(BaseTool, OriginalWorkflowTool):
else: var_exprs = origin_tdef.var_exprs
for key in var_exprs:
tr_var = interaction.newContent(portal_type='Transition Variable', temp_object=temp)
tr_var.setDefaultExpr(var_exprs[key].text)
tr_var.setDefaultExpression(var_exprs[key].text)
tr_var_path = getattr(workflow, 'variable_'+key).getPath()
tr_var_path = '/'.join(tr_var_path.split('/')[2:])
new_category.append(tr_var_path)
......
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