Commit 5474c085 authored by iv's avatar iv

ERP5Workflow: revert changes on renaming default_expr

changes were also applied to DC workflow, which should not be changed
parent 1a946029
......@@ -168,9 +168,9 @@ class InteractionWorkflowDefinition (DCWorkflowDefinition, ActiveObject):
if status is not None and status.has_key(name):
value = status[name]
# Not set yet. Use a default.
elif vdef.default_expression is not None:
elif vdef.default_expr is not None:
ec = createExprContext(StateChangeInfo(ob, self, status))
value = vdef.default_expression(ec)
value = vdef.default_expr(ec)
else:
value = vdef.default_value
......@@ -271,8 +271,8 @@ class InteractionWorkflowDefinition (DCWorkflowDefinition, ActiveObject):
# Preserve former value
value = former_status[id]
else:
if vdef.default_expression is not None:
expr = vdef.default_expression
if vdef.default_expr is not None:
expr = vdef.default_expr
else:
value = vdef.default_value
if expr is not None:
......@@ -445,7 +445,7 @@ class InteractionWorkflowDefinition (DCWorkflowDefinition, ActiveObject):
variable_reference_list = []
variable_id_list = sorted(self.variables.keys())
variable_prop_id_to_show = {'description':'text',
'default_expression':'string', 'for_catalog':'int', 'for_status':'int',
'default_expr':'string', 'for_catalog':'int', 'for_status':'int',
'update_always':'int'}
for vid in variable_id_list:
variable_reference_list.append(vid)
......@@ -456,7 +456,7 @@ class InteractionWorkflowDefinition (DCWorkflowDefinition, ActiveObject):
variable = SubElement(variables, 'variable', attrib=dict(reference=vdef.getReference(),
portal_type='Variable'))
for property_id in sorted(variable_prop_id_to_show):
if property_id == 'default_expression':
if property_id == 'default_expr':
expression = getattr(vdef, property_id, None)
if expression is not None:
property_value = expression.text
......
......@@ -7,7 +7,7 @@
<pickle>
<dictionary>
<item>
<key> <string>default_expression</string> </key>
<key> <string>default_expr</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
......
......@@ -7,7 +7,7 @@
<pickle>
<dictionary>
<item>
<key> <string>default_expression</string> </key>
<key> <string>default_expr</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
......
......@@ -7,7 +7,7 @@
<pickle>
<dictionary>
<item>
<key> <string>default_expression</string> </key>
<key> <string>default_expr</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
......
......@@ -7,7 +7,7 @@
<pickle>
<dictionary>
<item>
<key> <string>default_expression</string> </key>
<key> <string>default_expr</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
......
......@@ -7,7 +7,7 @@
<pickle>
<dictionary>
<item>
<key> <string>default_expression</string> </key>
<key> <string>default_expr</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
......
......@@ -7,7 +7,7 @@
<pickle>
<dictionary>
<item>
<key> <string>default_expression</string> </key>
<key> <string>default_expr</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
......
......@@ -7,7 +7,7 @@
<pickle>
<dictionary>
<item>
<key> <string>default_expression</string> </key>
<key> <string>default_expr</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
......
......@@ -7,7 +7,7 @@
<pickle>
<dictionary>
<item>
<key> <string>default_expression</string> </key>
<key> <string>default_expr</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
......
......@@ -7,7 +7,7 @@
<pickle>
<dictionary>
<item>
<key> <string>default_expression</string> </key>
<key> <string>default_expr</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
......
......@@ -7,7 +7,7 @@
<pickle>
<dictionary>
<item>
<key> <string>default_expression</string> </key>
<key> <string>default_expr</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
......
......@@ -7,7 +7,7 @@
<pickle>
<dictionary>
<item>
<key> <string>default_expression</string> </key>
<key> <string>default_expr</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
......
......@@ -7,7 +7,7 @@
<pickle>
<dictionary>
<item>
<key> <string>default_expression</string> </key>
<key> <string>default_expr</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
......
......@@ -7,7 +7,7 @@
<pickle>
<dictionary>
<item>
<key> <string>default_expression</string> </key>
<key> <string>default_expr</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
......
......@@ -7,7 +7,7 @@
<pickle>
<dictionary>
<item>
<key> <string>default_expression</string> </key>
<key> <string>default_expr</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
......
......@@ -7,7 +7,7 @@
<pickle>
<dictionary>
<item>
<key> <string>default_expression</string> </key>
<key> <string>default_expr</string> </key>
<value>
<none/>
</value>
......
......@@ -7,7 +7,7 @@
<pickle>
<dictionary>
<item>
<key> <string>default_expression</string> </key>
<key> <string>default_expr</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
......
......@@ -7,7 +7,7 @@
<pickle>
<dictionary>
<item>
<key> <string>default_expression</string> </key>
<key> <string>default_expr</string> </key>
<value>
<none/>
</value>
......
......@@ -7,7 +7,7 @@
<pickle>
<dictionary>
<item>
<key> <string>default_expression</string> </key>
<key> <string>default_expr</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
......
......@@ -7,7 +7,7 @@
<pickle>
<dictionary>
<item>
<key> <string>default_expression</string> </key>
<key> <string>default_expr</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
......
......@@ -7,7 +7,7 @@
<pickle>
<dictionary>
<item>
<key> <string>default_expression</string> </key>
<key> <string>default_expr</string> </key>
<value>
<none/>
</value>
......
......@@ -7,7 +7,7 @@
<pickle>
<dictionary>
<item>
<key> <string>default_expression</string> </key>
<key> <string>default_expr</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
......
......@@ -7,7 +7,7 @@
<pickle>
<dictionary>
<item>
<key> <string>default_expression</string> </key>
<key> <string>default_expr</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
......
......@@ -7,7 +7,7 @@
<pickle>
<dictionary>
<item>
<key> <string>default_expression</string> </key>
<key> <string>default_expr</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
......
......@@ -7,7 +7,7 @@
<pickle>
<dictionary>
<item>
<key> <string>default_expression</string> </key>
<key> <string>default_expr</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
......
......@@ -7,7 +7,7 @@
<pickle>
<dictionary>
<item>
<key> <string>default_expression</string> </key>
<key> <string>default_expr</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
......
......@@ -7,7 +7,7 @@
<pickle>
<dictionary>
<item>
<key> <string>default_expression</string> </key>
<key> <string>default_expr</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
......
......@@ -7,7 +7,7 @@
<pickle>
<dictionary>
<item>
<key> <string>default_expression</string> </key>
<key> <string>default_expr</string> </key>
<value>
<none/>
</value>
......
......@@ -7,7 +7,7 @@
<pickle>
<dictionary>
<item>
<key> <string>default_expression</string> </key>
<key> <string>default_expr</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
......
......@@ -7,7 +7,7 @@
<pickle>
<dictionary>
<item>
<key> <string>default_expression</string> </key>
<key> <string>default_expr</string> </key>
<value>
<none/>
</value>
......
......@@ -7,7 +7,7 @@
<pickle>
<dictionary>
<item>
<key> <string>default_expression</string> </key>
<key> <string>default_expr</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
......
......@@ -7,7 +7,7 @@
<pickle>
<dictionary>
<item>
<key> <string>default_expression</string> </key>
<key> <string>default_expr</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
......
......@@ -7,7 +7,7 @@
<pickle>
<dictionary>
<item>
<key> <string>default_expression</string> </key>
<key> <string>default_expr</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
......
......@@ -7,7 +7,7 @@
<pickle>
<dictionary>
<item>
<key> <string>default_expression</string> </key>
<key> <string>default_expr</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
......
......@@ -7,7 +7,7 @@
<pickle>
<dictionary>
<item>
<key> <string>default_expression</string> </key>
<key> <string>default_expr</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
......
......@@ -7,7 +7,7 @@
<pickle>
<dictionary>
<item>
<key> <string>default_expression</string> </key>
<key> <string>default_expr</string> </key>
<value>
<none/>
</value>
......
......@@ -7,7 +7,7 @@
<pickle>
<dictionary>
<item>
<key> <string>default_expression</string> </key>
<key> <string>default_expr</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
......
......@@ -7,7 +7,7 @@
<pickle>
<dictionary>
<item>
<key> <string>default_expression</string> </key>
<key> <string>default_expr</string> </key>
<value>
<none/>
</value>
......
......@@ -7,7 +7,7 @@
<pickle>
<dictionary>
<item>
<key> <string>default_expression</string> </key>
<key> <string>default_expr</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
......
......@@ -7,7 +7,7 @@
<pickle>
<dictionary>
<item>
<key> <string>default_expression</string> </key>
<key> <string>default_expr</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
......
......@@ -7,7 +7,7 @@
<pickle>
<dictionary>
<item>
<key> <string>default_expression</string> </key>
<key> <string>default_expr</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
......
......@@ -7,7 +7,7 @@
<pickle>
<dictionary>
<item>
<key> <string>default_expression</string> </key>
<key> <string>default_expr</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
......
......@@ -7,7 +7,7 @@
<pickle>
<dictionary>
<item>
<key> <string>default_expression</string> </key>
<key> <string>default_expr</string> </key>
<value>
<none/>
</value>
......
......@@ -7,7 +7,7 @@
<pickle>
<dictionary>
<item>
<key> <string>default_expression</string> </key>
<key> <string>default_expr</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
......
......@@ -7,7 +7,7 @@
<pickle>
<dictionary>
<item>
<key> <string>default_expression</string> </key>
<key> <string>default_expr</string> </key>
<value>
<none/>
</value>
......
......@@ -7,7 +7,7 @@
<pickle>
<dictionary>
<item>
<key> <string>default_expression</string> </key>
<key> <string>default_expr</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
......
......@@ -145,29 +145,29 @@ def setupERP5Workflow(wf):
for v, property_dict in (
('action', {
'description': 'Transition id',
'default_expression': 'transition/getId|nothing',
'default_expr': 'transition/getId|nothing',
'for_status': 1,
'update_always': 1,
}),
('actor', {
'description': 'Name of the user who performed transition',
'default_expression': 'user/getUserName',
'default_expr': 'user/getUserName',
'for_status': 1,
'update_always': 1,
}),
('comment', {
'description': 'Comment about transition',
'default_expression': "python:state_change.kwargs.get('comment', '')",
'default_expr': "python:state_change.kwargs.get('comment', '')",
'for_status': 1,
'update_always': 1,
}),
('history', {
'description': 'Provides access to workflow history',
'default_expression': 'state_change/getHistory',
'default_expr': 'state_change/getHistory',
}),
('time', {
'description': 'Transition timestamp',
'default_expression': 'state_change/getDateTime',
'default_expr': 'state_change/getDateTime',
'for_status': 1,
'update_always': 1,
}),
......
......@@ -439,8 +439,8 @@ def DCWorkflowDefinition_executeTransition(self, ob, tdef=None, kwargs=None):
# Preserve former value
value = former_status[id]
else:
if vdef.default_expression is not None:
expr = vdef.default_expression
if vdef.default_expr is not None:
expr = vdef.default_expr
else:
value = vdef.default_value
if expr is not None:
......@@ -545,8 +545,8 @@ def _executeMetaTransition(self, ob, new_state_id):
# Preserve former value
value = former_status[id]
else:
if vdef.default_expression is not None:
expr = vdef.default_expression
if vdef.default_expr is not None:
expr = vdef.default_expr
else:
value = vdef.default_value
if expr is not None:
......@@ -951,7 +951,7 @@ def DCWorkflowDefinition_showAsXML(self, root=None):
variable_reference_list = []
variable_id_list = sorted(self.variables.keys())
variable_prop_id_to_show = {'description':'text',
'default_expression':'string', 'for_catalog':'int', 'for_status':'int',
'default_expr':'string', 'for_catalog':'int', 'for_status':'int',
'update_always':'int'}
for vid in variable_id_list:
variable_reference_list.append(vid)
......@@ -962,7 +962,7 @@ def DCWorkflowDefinition_showAsXML(self, root=None):
variable = SubElement(variables, 'variable', attrib=dict(reference=vdef.getReference(),
portal_type='Variable'))
for property_id in sorted(variable_prop_id_to_show):
if property_id == 'default_expression':
if property_id == 'default_expr':
expression = getattr(vdef, property_id, None)
if expression is not None:
property_value = expression.text
......
......@@ -273,19 +273,19 @@ class InteractionWorkflow(IdAsReferenceMixin("", "prefix"), Workflow):
id = vdef.getId()
if not vdef.getForStatus():
continue
expr = None
expression = None
if id in tdef_exprs:
expr = tdef_exprs[id]
expression = tdef_exprs[id]
elif not vdef.getAutomaticUpdate() and id in former_status:
# Preserve former value
value = former_status[id]
else:
default_expression = vdef.getDefaultExpression()
if default_expression is not None:
expr = Expression(default_expression)
expression = Expression(default_expression)
else:
value = vdef.getInitialValue()
if expr is not None:
if expression is not None:
# Evaluate an expression.
if econtext is None:
# Lazily create the expression context.
......@@ -294,7 +294,7 @@ class InteractionWorkflow(IdAsReferenceMixin("", "prefix"), Workflow):
ob, self, former_status, tdef,
None, None, None)
econtext = createExprContext(sci)
value = expr(econtext)
value = expression(econtext)
status[id] = value
sci = StateChangeInfo(
......
......@@ -505,12 +505,12 @@ class WorkflowTool(BaseTool, OriginalWorkflowTool):
variable.setTitle(vdef.title)
variable.setReference(vdef.id)
variable.setAutomaticUpdate(vdef.update_always)
if getattr(vdef, 'default_expression', None) is not None:
if getattr(vdef, 'default_expr', None) is not None:
# for a very specific case, action return the reference of transition
# in order to generation correct workflow history.
if vid == 'action':
variable.setDefaultExpression('transition/getReference|nothing')
else: variable.setDefaultExpression(vdef.default_expression.text)
else: variable.setDefaultExpression(vdef.default_expr.text)
if vdef.info_guard:
variable.info_guard = vdef.info_guard
variable.setRoleList(vdef.info_guard.roles)
......
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