Commit 1a946029 authored by iv's avatar iv

ERP5Workflow: rename default_expr to default_expression

rename files my_default_expr.xml to my_default_expression.xml
rename default_expr to default_expression in xml files and scripts
parent 43faaf31
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
<dictionary> <dictionary>
<item> <item>
<key> <string>id</string> </key> <key> <string>id</string> </key>
<value> <string>my_default_expr</string> </value> <value> <string>my_default_expression</string> </value>
</item> </item>
<item> <item>
<key> <string>message_values</string> </key> <key> <string>message_values</string> </key>
......
...@@ -16,7 +16,7 @@ ...@@ -16,7 +16,7 @@
</item> </item>
<item> <item>
<key> <string>id</string> </key> <key> <string>id</string> </key>
<value> <string>my_default_expr</string> </value> <value> <string>my_default_expression</string> </value>
</item> </item>
<item> <item>
<key> <string>message_values</string> </key> <key> <string>message_values</string> </key>
......
...@@ -16,7 +16,7 @@ ...@@ -16,7 +16,7 @@
</item> </item>
<item> <item>
<key> <string>id</string> </key> <key> <string>id</string> </key>
<value> <string>my_default_expr</string> </value> <value> <string>my_default_expression</string> </value>
</item> </item>
<item> <item>
<key> <string>message_values</string> </key> <key> <string>message_values</string> </key>
......
...@@ -168,9 +168,9 @@ class InteractionWorkflowDefinition (DCWorkflowDefinition, ActiveObject): ...@@ -168,9 +168,9 @@ class InteractionWorkflowDefinition (DCWorkflowDefinition, ActiveObject):
if status is not None and status.has_key(name): if status is not None and status.has_key(name):
value = status[name] value = status[name]
# Not set yet. Use a default. # Not set yet. Use a default.
elif vdef.default_expr is not None: elif vdef.default_expression is not None:
ec = createExprContext(StateChangeInfo(ob, self, status)) ec = createExprContext(StateChangeInfo(ob, self, status))
value = vdef.default_expr(ec) value = vdef.default_expression(ec)
else: else:
value = vdef.default_value value = vdef.default_value
...@@ -271,8 +271,8 @@ class InteractionWorkflowDefinition (DCWorkflowDefinition, ActiveObject): ...@@ -271,8 +271,8 @@ class InteractionWorkflowDefinition (DCWorkflowDefinition, ActiveObject):
# Preserve former value # Preserve former value
value = former_status[id] value = former_status[id]
else: else:
if vdef.default_expr is not None: if vdef.default_expression is not None:
expr = vdef.default_expr expr = vdef.default_expression
else: else:
value = vdef.default_value value = vdef.default_value
if expr is not None: if expr is not None:
...@@ -445,7 +445,7 @@ class InteractionWorkflowDefinition (DCWorkflowDefinition, ActiveObject): ...@@ -445,7 +445,7 @@ class InteractionWorkflowDefinition (DCWorkflowDefinition, ActiveObject):
variable_reference_list = [] variable_reference_list = []
variable_id_list = sorted(self.variables.keys()) variable_id_list = sorted(self.variables.keys())
variable_prop_id_to_show = {'description':'text', variable_prop_id_to_show = {'description':'text',
'default_expr':'string', 'for_catalog':'int', 'for_status':'int', 'default_expression':'string', 'for_catalog':'int', 'for_status':'int',
'update_always':'int'} 'update_always':'int'}
for vid in variable_id_list: for vid in variable_id_list:
variable_reference_list.append(vid) variable_reference_list.append(vid)
...@@ -456,7 +456,7 @@ class InteractionWorkflowDefinition (DCWorkflowDefinition, ActiveObject): ...@@ -456,7 +456,7 @@ class InteractionWorkflowDefinition (DCWorkflowDefinition, ActiveObject):
variable = SubElement(variables, 'variable', attrib=dict(reference=vdef.getReference(), variable = SubElement(variables, 'variable', attrib=dict(reference=vdef.getReference(),
portal_type='Variable')) portal_type='Variable'))
for property_id in sorted(variable_prop_id_to_show): for property_id in sorted(variable_prop_id_to_show):
if property_id == 'default_expr': if property_id == 'default_expression':
expression = getattr(vdef, property_id, None) expression = getattr(vdef, property_id, None)
if expression is not None: if expression is not None:
property_value = expression.text property_value = expression.text
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
<pickle> <pickle>
<dictionary> <dictionary>
<item> <item>
<key> <string>default_expr</string> </key> <key> <string>default_expression</string> </key>
<value> <value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent> <persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value> </value>
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
<pickle> <pickle>
<dictionary> <dictionary>
<item> <item>
<key> <string>default_expr</string> </key> <key> <string>default_expression</string> </key>
<value> <value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent> <persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value> </value>
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
<pickle> <pickle>
<dictionary> <dictionary>
<item> <item>
<key> <string>default_expr</string> </key> <key> <string>default_expression</string> </key>
<value> <value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent> <persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value> </value>
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
<pickle> <pickle>
<dictionary> <dictionary>
<item> <item>
<key> <string>default_expr</string> </key> <key> <string>default_expression</string> </key>
<value> <value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent> <persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value> </value>
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
<pickle> <pickle>
<dictionary> <dictionary>
<item> <item>
<key> <string>default_expr</string> </key> <key> <string>default_expression</string> </key>
<value> <value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent> <persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value> </value>
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
<pickle> <pickle>
<dictionary> <dictionary>
<item> <item>
<key> <string>default_expr</string> </key> <key> <string>default_expression</string> </key>
<value> <value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent> <persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value> </value>
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
<pickle> <pickle>
<dictionary> <dictionary>
<item> <item>
<key> <string>default_expr</string> </key> <key> <string>default_expression</string> </key>
<value> <value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent> <persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value> </value>
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
<pickle> <pickle>
<dictionary> <dictionary>
<item> <item>
<key> <string>default_expr</string> </key> <key> <string>default_expression</string> </key>
<value> <value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent> <persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value> </value>
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
<pickle> <pickle>
<dictionary> <dictionary>
<item> <item>
<key> <string>default_expr</string> </key> <key> <string>default_expression</string> </key>
<value> <value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent> <persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value> </value>
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
<pickle> <pickle>
<dictionary> <dictionary>
<item> <item>
<key> <string>default_expr</string> </key> <key> <string>default_expression</string> </key>
<value> <value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent> <persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value> </value>
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
<pickle> <pickle>
<dictionary> <dictionary>
<item> <item>
<key> <string>default_expr</string> </key> <key> <string>default_expression</string> </key>
<value> <value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent> <persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value> </value>
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
<pickle> <pickle>
<dictionary> <dictionary>
<item> <item>
<key> <string>default_expr</string> </key> <key> <string>default_expression</string> </key>
<value> <value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent> <persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value> </value>
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
<pickle> <pickle>
<dictionary> <dictionary>
<item> <item>
<key> <string>default_expr</string> </key> <key> <string>default_expression</string> </key>
<value> <value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent> <persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value> </value>
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
<pickle> <pickle>
<dictionary> <dictionary>
<item> <item>
<key> <string>default_expr</string> </key> <key> <string>default_expression</string> </key>
<value> <value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent> <persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value> </value>
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
<pickle> <pickle>
<dictionary> <dictionary>
<item> <item>
<key> <string>default_expr</string> </key> <key> <string>default_expression</string> </key>
<value> <value>
<none/> <none/>
</value> </value>
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
<pickle> <pickle>
<dictionary> <dictionary>
<item> <item>
<key> <string>default_expr</string> </key> <key> <string>default_expression</string> </key>
<value> <value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent> <persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value> </value>
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
<pickle> <pickle>
<dictionary> <dictionary>
<item> <item>
<key> <string>default_expr</string> </key> <key> <string>default_expression</string> </key>
<value> <value>
<none/> <none/>
</value> </value>
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
<pickle> <pickle>
<dictionary> <dictionary>
<item> <item>
<key> <string>default_expr</string> </key> <key> <string>default_expression</string> </key>
<value> <value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent> <persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value> </value>
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
<pickle> <pickle>
<dictionary> <dictionary>
<item> <item>
<key> <string>default_expr</string> </key> <key> <string>default_expression</string> </key>
<value> <value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent> <persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value> </value>
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
<pickle> <pickle>
<dictionary> <dictionary>
<item> <item>
<key> <string>default_expr</string> </key> <key> <string>default_expression</string> </key>
<value> <value>
<none/> <none/>
</value> </value>
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
<pickle> <pickle>
<dictionary> <dictionary>
<item> <item>
<key> <string>default_expr</string> </key> <key> <string>default_expression</string> </key>
<value> <value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent> <persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value> </value>
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
<pickle> <pickle>
<dictionary> <dictionary>
<item> <item>
<key> <string>default_expr</string> </key> <key> <string>default_expression</string> </key>
<value> <value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent> <persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value> </value>
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
<pickle> <pickle>
<dictionary> <dictionary>
<item> <item>
<key> <string>default_expr</string> </key> <key> <string>default_expression</string> </key>
<value> <value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent> <persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value> </value>
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
<pickle> <pickle>
<dictionary> <dictionary>
<item> <item>
<key> <string>default_expr</string> </key> <key> <string>default_expression</string> </key>
<value> <value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent> <persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value> </value>
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
<pickle> <pickle>
<dictionary> <dictionary>
<item> <item>
<key> <string>default_expr</string> </key> <key> <string>default_expression</string> </key>
<value> <value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent> <persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value> </value>
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
<pickle> <pickle>
<dictionary> <dictionary>
<item> <item>
<key> <string>default_expr</string> </key> <key> <string>default_expression</string> </key>
<value> <value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent> <persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value> </value>
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
<pickle> <pickle>
<dictionary> <dictionary>
<item> <item>
<key> <string>default_expr</string> </key> <key> <string>default_expression</string> </key>
<value> <value>
<none/> <none/>
</value> </value>
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
<pickle> <pickle>
<dictionary> <dictionary>
<item> <item>
<key> <string>default_expr</string> </key> <key> <string>default_expression</string> </key>
<value> <value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent> <persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value> </value>
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
<pickle> <pickle>
<dictionary> <dictionary>
<item> <item>
<key> <string>default_expr</string> </key> <key> <string>default_expression</string> </key>
<value> <value>
<none/> <none/>
</value> </value>
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
<pickle> <pickle>
<dictionary> <dictionary>
<item> <item>
<key> <string>default_expr</string> </key> <key> <string>default_expression</string> </key>
<value> <value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent> <persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value> </value>
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
<pickle> <pickle>
<dictionary> <dictionary>
<item> <item>
<key> <string>default_expr</string> </key> <key> <string>default_expression</string> </key>
<value> <value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent> <persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value> </value>
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
<pickle> <pickle>
<dictionary> <dictionary>
<item> <item>
<key> <string>default_expr</string> </key> <key> <string>default_expression</string> </key>
<value> <value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent> <persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value> </value>
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
<pickle> <pickle>
<dictionary> <dictionary>
<item> <item>
<key> <string>default_expr</string> </key> <key> <string>default_expression</string> </key>
<value> <value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent> <persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value> </value>
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
<pickle> <pickle>
<dictionary> <dictionary>
<item> <item>
<key> <string>default_expr</string> </key> <key> <string>default_expression</string> </key>
<value> <value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent> <persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value> </value>
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
<pickle> <pickle>
<dictionary> <dictionary>
<item> <item>
<key> <string>default_expr</string> </key> <key> <string>default_expression</string> </key>
<value> <value>
<none/> <none/>
</value> </value>
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
<pickle> <pickle>
<dictionary> <dictionary>
<item> <item>
<key> <string>default_expr</string> </key> <key> <string>default_expression</string> </key>
<value> <value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent> <persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value> </value>
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
<pickle> <pickle>
<dictionary> <dictionary>
<item> <item>
<key> <string>default_expr</string> </key> <key> <string>default_expression</string> </key>
<value> <value>
<none/> <none/>
</value> </value>
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
<pickle> <pickle>
<dictionary> <dictionary>
<item> <item>
<key> <string>default_expr</string> </key> <key> <string>default_expression</string> </key>
<value> <value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent> <persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value> </value>
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
<pickle> <pickle>
<dictionary> <dictionary>
<item> <item>
<key> <string>default_expr</string> </key> <key> <string>default_expression</string> </key>
<value> <value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent> <persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value> </value>
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
<pickle> <pickle>
<dictionary> <dictionary>
<item> <item>
<key> <string>default_expr</string> </key> <key> <string>default_expression</string> </key>
<value> <value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent> <persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value> </value>
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
<pickle> <pickle>
<dictionary> <dictionary>
<item> <item>
<key> <string>default_expr</string> </key> <key> <string>default_expression</string> </key>
<value> <value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent> <persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value> </value>
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
<pickle> <pickle>
<dictionary> <dictionary>
<item> <item>
<key> <string>default_expr</string> </key> <key> <string>default_expression</string> </key>
<value> <value>
<none/> <none/>
</value> </value>
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
<pickle> <pickle>
<dictionary> <dictionary>
<item> <item>
<key> <string>default_expr</string> </key> <key> <string>default_expression</string> </key>
<value> <value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent> <persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value> </value>
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
<pickle> <pickle>
<dictionary> <dictionary>
<item> <item>
<key> <string>default_expr</string> </key> <key> <string>default_expression</string> </key>
<value> <value>
<none/> <none/>
</value> </value>
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
<pickle> <pickle>
<dictionary> <dictionary>
<item> <item>
<key> <string>default_expr</string> </key> <key> <string>default_expression</string> </key>
<value> <value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent> <persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value> </value>
......
...@@ -22,7 +22,7 @@ ...@@ -22,7 +22,7 @@
</item> </item>
<item> <item>
<key> <string>id</string> </key> <key> <string>id</string> </key>
<value> <string>default_expr_property</string> </value> <value> <string>default_expression_property</string> </value>
</item> </item>
<item> <item>
<key> <string>portal_type</string> </key> <key> <string>portal_type</string> </key>
...@@ -30,7 +30,7 @@ ...@@ -30,7 +30,7 @@
</item> </item>
<item> <item>
<key> <string>storage_id</string> </key> <key> <string>storage_id</string> </key>
<value> <string>default_expr</string> </value> <value> <string>default_expression</string> </value>
</item> </item>
</dictionary> </dictionary>
</pickle> </pickle>
......
...@@ -145,29 +145,29 @@ def setupERP5Workflow(wf): ...@@ -145,29 +145,29 @@ def setupERP5Workflow(wf):
for v, property_dict in ( for v, property_dict in (
('action', { ('action', {
'description': 'Transition id', 'description': 'Transition id',
'default_expr': 'transition/getId|nothing', 'default_expression': 'transition/getId|nothing',
'for_status': 1, 'for_status': 1,
'update_always': 1, 'update_always': 1,
}), }),
('actor', { ('actor', {
'description': 'Name of the user who performed transition', 'description': 'Name of the user who performed transition',
'default_expr': 'user/getUserName', 'default_expression': 'user/getUserName',
'for_status': 1, 'for_status': 1,
'update_always': 1, 'update_always': 1,
}), }),
('comment', { ('comment', {
'description': 'Comment about transition', 'description': 'Comment about transition',
'default_expr': "python:state_change.kwargs.get('comment', '')", 'default_expression': "python:state_change.kwargs.get('comment', '')",
'for_status': 1, 'for_status': 1,
'update_always': 1, 'update_always': 1,
}), }),
('history', { ('history', {
'description': 'Provides access to workflow history', 'description': 'Provides access to workflow history',
'default_expr': 'state_change/getHistory', 'default_expression': 'state_change/getHistory',
}), }),
('time', { ('time', {
'description': 'Transition timestamp', 'description': 'Transition timestamp',
'default_expr': 'state_change/getDateTime', 'default_expression': 'state_change/getDateTime',
'for_status': 1, 'for_status': 1,
'update_always': 1, 'update_always': 1,
}), }),
......
...@@ -439,8 +439,8 @@ def DCWorkflowDefinition_executeTransition(self, ob, tdef=None, kwargs=None): ...@@ -439,8 +439,8 @@ def DCWorkflowDefinition_executeTransition(self, ob, tdef=None, kwargs=None):
# Preserve former value # Preserve former value
value = former_status[id] value = former_status[id]
else: else:
if vdef.default_expr is not None: if vdef.default_expression is not None:
expr = vdef.default_expr expr = vdef.default_expression
else: else:
value = vdef.default_value value = vdef.default_value
if expr is not None: if expr is not None:
...@@ -545,8 +545,8 @@ def _executeMetaTransition(self, ob, new_state_id): ...@@ -545,8 +545,8 @@ def _executeMetaTransition(self, ob, new_state_id):
# Preserve former value # Preserve former value
value = former_status[id] value = former_status[id]
else: else:
if vdef.default_expr is not None: if vdef.default_expression is not None:
expr = vdef.default_expr expr = vdef.default_expression
else: else:
value = vdef.default_value value = vdef.default_value
if expr is not None: if expr is not None:
...@@ -951,7 +951,7 @@ def DCWorkflowDefinition_showAsXML(self, root=None): ...@@ -951,7 +951,7 @@ def DCWorkflowDefinition_showAsXML(self, root=None):
variable_reference_list = [] variable_reference_list = []
variable_id_list = sorted(self.variables.keys()) variable_id_list = sorted(self.variables.keys())
variable_prop_id_to_show = {'description':'text', variable_prop_id_to_show = {'description':'text',
'default_expr':'string', 'for_catalog':'int', 'for_status':'int', 'default_expression':'string', 'for_catalog':'int', 'for_status':'int',
'update_always':'int'} 'update_always':'int'}
for vid in variable_id_list: for vid in variable_id_list:
variable_reference_list.append(vid) variable_reference_list.append(vid)
...@@ -962,7 +962,7 @@ def DCWorkflowDefinition_showAsXML(self, root=None): ...@@ -962,7 +962,7 @@ def DCWorkflowDefinition_showAsXML(self, root=None):
variable = SubElement(variables, 'variable', attrib=dict(reference=vdef.getReference(), variable = SubElement(variables, 'variable', attrib=dict(reference=vdef.getReference(),
portal_type='Variable')) portal_type='Variable'))
for property_id in sorted(variable_prop_id_to_show): for property_id in sorted(variable_prop_id_to_show):
if property_id == 'default_expr': if property_id == 'default_expression':
expression = getattr(vdef, property_id, None) expression = getattr(vdef, property_id, None)
if expression is not None: if expression is not None:
property_value = expression.text property_value = expression.text
......
...@@ -140,13 +140,13 @@ class InteractionWorkflow(IdAsReferenceMixin("", "prefix"), Workflow): ...@@ -140,13 +140,13 @@ class InteractionWorkflow(IdAsReferenceMixin("", "prefix"), Workflow):
getSecurityManager(), self, ob): getSecurityManager(), self, ob):
return default return default
status = self._getStatusOf(ob) status = self._getStatusOf(ob)
default_expr = vdef.getDefaultExpression() default_expression = vdef.getDefaultExpression()
if status is not None and name in status: if status is not None and name in status:
value = status[name] value = status[name]
# Not set yet. Use a default. # Not set yet. Use a default.
elif default_expr is not None: elif default_expression is not None:
ec = createExprContext(StateChangeInfo(ob, self, status)) ec = createExprContext(StateChangeInfo(ob, self, status))
value = Expression(default_expr)(ec) value = Expression(default_expression)(ec)
else: else:
value = vdef.getInitialValue() value = vdef.getInitialValue()
...@@ -280,9 +280,9 @@ class InteractionWorkflow(IdAsReferenceMixin("", "prefix"), Workflow): ...@@ -280,9 +280,9 @@ class InteractionWorkflow(IdAsReferenceMixin("", "prefix"), Workflow):
# Preserve former value # Preserve former value
value = former_status[id] value = former_status[id]
else: else:
default_expr = vdef.getDefaultExpression() default_expression = vdef.getDefaultExpression()
if default_expr is not None: if default_expression is not None:
expr = Expression(default_expr) expr = Expression(default_expression)
else: else:
value = vdef.getInitialValue() value = vdef.getInitialValue()
if expr is not None: if expr is not None:
...@@ -459,7 +459,7 @@ class InteractionWorkflow(IdAsReferenceMixin("", "prefix"), Workflow): ...@@ -459,7 +459,7 @@ class InteractionWorkflow(IdAsReferenceMixin("", "prefix"), Workflow):
# 2. Variable as XML # 2. Variable as XML
variable_reference_list = [] variable_reference_list = []
variable_list = self.objectValues(portal_type='Variable') variable_list = self.objectValues(portal_type='Variable')
variable_prop_id_to_show = ['description', 'default_expr', variable_prop_id_to_show = ['description', 'default_expression',
'for_catalog', 'for_status', 'update_always'] 'for_catalog', 'for_status', 'update_always']
for vdef in variable_list: for vdef in variable_list:
variable_reference_list.append(vdef.getReference()) variable_reference_list.append(vdef.getReference())
......
...@@ -49,7 +49,7 @@ class Variable(IdAsReferenceMixin("variable_", "prefix"), XMLObject): ...@@ -49,7 +49,7 @@ class Variable(IdAsReferenceMixin("variable_", "prefix"), XMLObject):
for_catalog = 1 for_catalog = 1
for_status = 1 for_status = 1
default_value = '' default_value = ''
default_expr = None # Overrides default_value if set default_expression = None # Overrides default_value if set
update_always = 1 update_always = 1
default_reference = '' default_reference = ''
# Declarative security # Declarative security
......
...@@ -429,14 +429,14 @@ class Workflow(IdAsReferenceMixin("", "prefix"), XMLObject): ...@@ -429,14 +429,14 @@ class Workflow(IdAsReferenceMixin("", "prefix"), XMLObject):
getSecurityManager(), self, ob): getSecurityManager(), self, ob):
return default return default
status = self.getCurrentStatusDict(ob) status = self.getCurrentStatusDict(ob)
default_expr = vdef.getDefaultExpression() default_expression = vdef.getDefaultExpression()
if status is not None and status.has_key(name): if status is not None and status.has_key(name):
value = status[name] value = status[name]
# Not set yet. Use a default. # Not set yet. Use a default.
elif default_expr is not None: elif default_expression is not None:
ec = createExprContext(StateChangeInfo(ob, self, status)) ec = createExprContext(StateChangeInfo(ob, self, status))
value = Expression(default_expr)(ec) value = Expression(default_expression)(ec)
else: else:
value = vdef.getInitialValue() value = vdef.getInitialValue()
...@@ -907,7 +907,7 @@ class Workflow(IdAsReferenceMixin("", "prefix"), XMLObject): ...@@ -907,7 +907,7 @@ class Workflow(IdAsReferenceMixin("", "prefix"), XMLObject):
# 3. Variable as XML # 3. Variable as XML
variable_reference_list = [] variable_reference_list = []
variable_list = self.objectValues(portal_type='Variable') variable_list = self.objectValues(portal_type='Variable')
variable_prop_id_to_show = ['description', 'default_expr', variable_prop_id_to_show = ['description', 'default_expression',
'for_catalog', 'for_status', 'update_always'] 'for_catalog', 'for_status', 'update_always']
for vdef in variable_list: for vdef in variable_list:
variable_reference_list.append(vdef.getReference()) variable_reference_list.append(vdef.getReference())
...@@ -934,7 +934,7 @@ class Workflow(IdAsReferenceMixin("", "prefix"), XMLObject): ...@@ -934,7 +934,7 @@ class Workflow(IdAsReferenceMixin("", "prefix"), XMLObject):
sub_object.text = str(property_value) sub_object.text = str(property_value)
# for a very specific case, action return the reference of transition, # for a very specific case, action return the reference of transition,
# but in XML should show the same expression as in DC workflow. # but in XML should show the same expression as in DC workflow.
if vdef.getId() == 'variable_action' and property_id == 'default_expr' and property_value != '': if vdef.getId() == 'variable_action' and property_id == 'default_expression' and property_value != '':
sub_object.text = str('transition/getId|nothing') sub_object.text = str('transition/getId|nothing')
# 4. Worklist as XML # 4. Worklist as XML
...@@ -1068,9 +1068,9 @@ class Workflow(IdAsReferenceMixin("", "prefix"), XMLObject): ...@@ -1068,9 +1068,9 @@ class Workflow(IdAsReferenceMixin("", "prefix"), XMLObject):
# Preserve former value # Preserve former value
value = former_status[id] value = former_status[id]
else: else:
default_expr = vdef.getDefaultExpression() default_expression = vdef.getDefaultExpression()
if default_expr is not None: if default_expression is not None:
expr = Expression(default_expr) expr = Expression(default_expression)
else: else:
value = vdef.getInitialValue() value = vdef.getInitialValue()
if expr is not None: if expr is not None:
...@@ -1120,15 +1120,15 @@ class Workflow(IdAsReferenceMixin("", "prefix"), XMLObject): ...@@ -1120,15 +1120,15 @@ class Workflow(IdAsReferenceMixin("", "prefix"), XMLObject):
status = self.getCurrentStatusDict(ob) status = self.getCurrentStatusDict(ob)
for vdef_ref, vdef in self.getVariableValueDict().iteritems(): for vdef_ref, vdef in self.getVariableValueDict().iteritems():
if vdef.getForCatalog(): if vdef.getForCatalog():
default_expr = vdef.getDefaultExpression() default_expression = vdef.getDefaultExpression()
if status.has_key(vdef_ref): if status.has_key(vdef_ref):
value = status[vdef_ref] value = status[vdef_ref]
# Not set yet. Use a default. # Not set yet. Use a default.
elif default_expr is not None: elif default_expression is not None:
ec = createExprContext(StateChangeInfo(ob, self, status)) ec = createExprContext(StateChangeInfo(ob, self, status))
# convert string to expression before execute it. # convert string to expression before execute it.
value = Expression(default_expr)(ec) value = Expression(default_expression)(ec)
else: else:
value = vdef.getInitialValue() value = vdef.getInitialValue()
if hasattr(self, 'getSourceValue'): if hasattr(self, 'getSourceValue'):
......
...@@ -39,7 +39,7 @@ class WorklistVariable(IdAsReferenceMixin("variable_", "prefix"), XMLObject): ...@@ -39,7 +39,7 @@ class WorklistVariable(IdAsReferenceMixin("variable_", "prefix"), XMLObject):
This type of object has 3 values: This type of object has 3 values:
- reference as Title; - reference as Title;
- default_value; - default_value;
- default_expr which will override default when it's set. - default_expression which will override default when it's set.
""" """
meta_type = 'ERP5 Variable' meta_type = 'ERP5 Variable'
...@@ -49,7 +49,7 @@ class WorklistVariable(IdAsReferenceMixin("variable_", "prefix"), XMLObject): ...@@ -49,7 +49,7 @@ class WorklistVariable(IdAsReferenceMixin("variable_", "prefix"), XMLObject):
isRADContent = 1 isRADContent = 1
default_value = '' default_value = ''
default_expr = None # Overrides default_value if set default_expression = None # Overrides default_value if set
default_reference = '' default_reference = ''
# Declarative security # Declarative security
security = ClassSecurityInfo() security = ClassSecurityInfo()
......
...@@ -505,12 +505,12 @@ class WorkflowTool(BaseTool, OriginalWorkflowTool): ...@@ -505,12 +505,12 @@ class WorkflowTool(BaseTool, OriginalWorkflowTool):
variable.setTitle(vdef.title) variable.setTitle(vdef.title)
variable.setReference(vdef.id) variable.setReference(vdef.id)
variable.setAutomaticUpdate(vdef.update_always) variable.setAutomaticUpdate(vdef.update_always)
if getattr(vdef, 'default_expr', None) is not None: if getattr(vdef, 'default_expression', None) is not None:
# for a very specific case, action return the reference of transition # for a very specific case, action return the reference of transition
# in order to generation correct workflow history. # in order to generation correct workflow history.
if vid == 'action': if vid == 'action':
variable.setDefaultExpression('transition/getReference|nothing') variable.setDefaultExpression('transition/getReference|nothing')
else: variable.setDefaultExpression(vdef.default_expr.text) else: variable.setDefaultExpression(vdef.default_expression.text)
if vdef.info_guard: if vdef.info_guard:
variable.info_guard = vdef.info_guard variable.info_guard = vdef.info_guard
variable.setRoleList(vdef.info_guard.roles) variable.setRoleList(vdef.info_guard.roles)
......
...@@ -126,7 +126,7 @@ class TestERP5Workflow(ERP5TypeTestCase): ...@@ -126,7 +126,7 @@ class TestERP5Workflow(ERP5TypeTestCase):
v1 = workflow.newContent(portal_type='Variable', v1 = workflow.newContent(portal_type='Variable',
title='actor') title='actor')
v1.setReference('actor') v1.setReference('actor')
v1.default_expr = 'user/getUserName' v1.default_expression = 'user/getUserName'
self.getPortalObject().portal_types._getOb('Folder').edit(type_workflow_list=('wf')) self.getPortalObject().portal_types._getOb('Folder').edit(type_workflow_list=('wf'))
doc = self.portal.newContent(portal_type='Folder', id='test_doc') doc = self.portal.newContent(portal_type='Folder', id='test_doc')
workflow._executeTransition(doc,t1) workflow._executeTransition(doc,t1)
......
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