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 @@
<dictionary>
<item>
<key> <string>id</string> </key>
<value> <string>my_default_expr</string> </value>
<value> <string>my_default_expression</string> </value>
</item>
<item>
<key> <string>message_values</string> </key>
......
......@@ -16,7 +16,7 @@
</item>
<item>
<key> <string>id</string> </key>
<value> <string>my_default_expr</string> </value>
<value> <string>my_default_expression</string> </value>
</item>
<item>
<key> <string>message_values</string> </key>
......
......@@ -16,7 +16,7 @@
</item>
<item>
<key> <string>id</string> </key>
<value> <string>my_default_expr</string> </value>
<value> <string>my_default_expression</string> </value>
</item>
<item>
<key> <string>message_values</string> </key>
......
......@@ -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_expr is not None:
elif vdef.default_expression is not None:
ec = createExprContext(StateChangeInfo(ob, self, status))
value = vdef.default_expr(ec)
value = vdef.default_expression(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_expr is not None:
expr = vdef.default_expr
if vdef.default_expression is not None:
expr = vdef.default_expression
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_expr':'string', 'for_catalog':'int', 'for_status':'int',
'default_expression':'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_expr':
if property_id == 'default_expression':
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_expr</string> </key>
<key> <string>default_expression</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
......
......@@ -7,7 +7,7 @@
<pickle>
<dictionary>
<item>
<key> <string>default_expr</string> </key>
<key> <string>default_expression</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
......
......@@ -7,7 +7,7 @@
<pickle>
<dictionary>
<item>
<key> <string>default_expr</string> </key>
<key> <string>default_expression</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
......
......@@ -7,7 +7,7 @@
<pickle>
<dictionary>
<item>
<key> <string>default_expr</string> </key>
<key> <string>default_expression</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
......
......@@ -7,7 +7,7 @@
<pickle>
<dictionary>
<item>
<key> <string>default_expr</string> </key>
<key> <string>default_expression</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
......
......@@ -7,7 +7,7 @@
<pickle>
<dictionary>
<item>
<key> <string>default_expr</string> </key>
<key> <string>default_expression</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
......
......@@ -7,7 +7,7 @@
<pickle>
<dictionary>
<item>
<key> <string>default_expr</string> </key>
<key> <string>default_expression</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
......
......@@ -7,7 +7,7 @@
<pickle>
<dictionary>
<item>
<key> <string>default_expr</string> </key>
<key> <string>default_expression</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
......
......@@ -7,7 +7,7 @@
<pickle>
<dictionary>
<item>
<key> <string>default_expr</string> </key>
<key> <string>default_expression</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
......
......@@ -7,7 +7,7 @@
<pickle>
<dictionary>
<item>
<key> <string>default_expr</string> </key>
<key> <string>default_expression</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
......
......@@ -7,7 +7,7 @@
<pickle>
<dictionary>
<item>
<key> <string>default_expr</string> </key>
<key> <string>default_expression</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
......
......@@ -7,7 +7,7 @@
<pickle>
<dictionary>
<item>
<key> <string>default_expr</string> </key>
<key> <string>default_expression</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
......
......@@ -7,7 +7,7 @@
<pickle>
<dictionary>
<item>
<key> <string>default_expr</string> </key>
<key> <string>default_expression</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
......
......@@ -7,7 +7,7 @@
<pickle>
<dictionary>
<item>
<key> <string>default_expr</string> </key>
<key> <string>default_expression</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
......
......@@ -7,7 +7,7 @@
<pickle>
<dictionary>
<item>
<key> <string>default_expr</string> </key>
<key> <string>default_expression</string> </key>
<value>
<none/>
</value>
......
......@@ -7,7 +7,7 @@
<pickle>
<dictionary>
<item>
<key> <string>default_expr</string> </key>
<key> <string>default_expression</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
......
......@@ -7,7 +7,7 @@
<pickle>
<dictionary>
<item>
<key> <string>default_expr</string> </key>
<key> <string>default_expression</string> </key>
<value>
<none/>
</value>
......
......@@ -7,7 +7,7 @@
<pickle>
<dictionary>
<item>
<key> <string>default_expr</string> </key>
<key> <string>default_expression</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
......
......@@ -7,7 +7,7 @@
<pickle>
<dictionary>
<item>
<key> <string>default_expr</string> </key>
<key> <string>default_expression</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
......
......@@ -7,7 +7,7 @@
<pickle>
<dictionary>
<item>
<key> <string>default_expr</string> </key>
<key> <string>default_expression</string> </key>
<value>
<none/>
</value>
......
......@@ -7,7 +7,7 @@
<pickle>
<dictionary>
<item>
<key> <string>default_expr</string> </key>
<key> <string>default_expression</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
......
......@@ -7,7 +7,7 @@
<pickle>
<dictionary>
<item>
<key> <string>default_expr</string> </key>
<key> <string>default_expression</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
......
......@@ -7,7 +7,7 @@
<pickle>
<dictionary>
<item>
<key> <string>default_expr</string> </key>
<key> <string>default_expression</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
......
......@@ -7,7 +7,7 @@
<pickle>
<dictionary>
<item>
<key> <string>default_expr</string> </key>
<key> <string>default_expression</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
......
......@@ -7,7 +7,7 @@
<pickle>
<dictionary>
<item>
<key> <string>default_expr</string> </key>
<key> <string>default_expression</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
......
......@@ -7,7 +7,7 @@
<pickle>
<dictionary>
<item>
<key> <string>default_expr</string> </key>
<key> <string>default_expression</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
......
......@@ -7,7 +7,7 @@
<pickle>
<dictionary>
<item>
<key> <string>default_expr</string> </key>
<key> <string>default_expression</string> </key>
<value>
<none/>
</value>
......
......@@ -7,7 +7,7 @@
<pickle>
<dictionary>
<item>
<key> <string>default_expr</string> </key>
<key> <string>default_expression</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
......
......@@ -7,7 +7,7 @@
<pickle>
<dictionary>
<item>
<key> <string>default_expr</string> </key>
<key> <string>default_expression</string> </key>
<value>
<none/>
</value>
......
......@@ -7,7 +7,7 @@
<pickle>
<dictionary>
<item>
<key> <string>default_expr</string> </key>
<key> <string>default_expression</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
......
......@@ -7,7 +7,7 @@
<pickle>
<dictionary>
<item>
<key> <string>default_expr</string> </key>
<key> <string>default_expression</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
......
......@@ -7,7 +7,7 @@
<pickle>
<dictionary>
<item>
<key> <string>default_expr</string> </key>
<key> <string>default_expression</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
......
......@@ -7,7 +7,7 @@
<pickle>
<dictionary>
<item>
<key> <string>default_expr</string> </key>
<key> <string>default_expression</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
......
......@@ -7,7 +7,7 @@
<pickle>
<dictionary>
<item>
<key> <string>default_expr</string> </key>
<key> <string>default_expression</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
......
......@@ -7,7 +7,7 @@
<pickle>
<dictionary>
<item>
<key> <string>default_expr</string> </key>
<key> <string>default_expression</string> </key>
<value>
<none/>
</value>
......
......@@ -7,7 +7,7 @@
<pickle>
<dictionary>
<item>
<key> <string>default_expr</string> </key>
<key> <string>default_expression</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
......
......@@ -7,7 +7,7 @@
<pickle>
<dictionary>
<item>
<key> <string>default_expr</string> </key>
<key> <string>default_expression</string> </key>
<value>
<none/>
</value>
......
......@@ -7,7 +7,7 @@
<pickle>
<dictionary>
<item>
<key> <string>default_expr</string> </key>
<key> <string>default_expression</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
......
......@@ -7,7 +7,7 @@
<pickle>
<dictionary>
<item>
<key> <string>default_expr</string> </key>
<key> <string>default_expression</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
......
......@@ -7,7 +7,7 @@
<pickle>
<dictionary>
<item>
<key> <string>default_expr</string> </key>
<key> <string>default_expression</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
......
......@@ -7,7 +7,7 @@
<pickle>
<dictionary>
<item>
<key> <string>default_expr</string> </key>
<key> <string>default_expression</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
......
......@@ -7,7 +7,7 @@
<pickle>
<dictionary>
<item>
<key> <string>default_expr</string> </key>
<key> <string>default_expression</string> </key>
<value>
<none/>
</value>
......
......@@ -7,7 +7,7 @@
<pickle>
<dictionary>
<item>
<key> <string>default_expr</string> </key>
<key> <string>default_expression</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
......
......@@ -7,7 +7,7 @@
<pickle>
<dictionary>
<item>
<key> <string>default_expr</string> </key>
<key> <string>default_expression</string> </key>
<value>
<none/>
</value>
......
......@@ -7,7 +7,7 @@
<pickle>
<dictionary>
<item>
<key> <string>default_expr</string> </key>
<key> <string>default_expression</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
......
......@@ -22,7 +22,7 @@
</item>
<item>
<key> <string>id</string> </key>
<value> <string>default_expr_property</string> </value>
<value> <string>default_expression_property</string> </value>
</item>
<item>
<key> <string>portal_type</string> </key>
......@@ -30,7 +30,7 @@
</item>
<item>
<key> <string>storage_id</string> </key>
<value> <string>default_expr</string> </value>
<value> <string>default_expression</string> </value>
</item>
</dictionary>
</pickle>
......
......@@ -145,29 +145,29 @@ def setupERP5Workflow(wf):
for v, property_dict in (
('action', {
'description': 'Transition id',
'default_expr': 'transition/getId|nothing',
'default_expression': 'transition/getId|nothing',
'for_status': 1,
'update_always': 1,
}),
('actor', {
'description': 'Name of the user who performed transition',
'default_expr': 'user/getUserName',
'default_expression': 'user/getUserName',
'for_status': 1,
'update_always': 1,
}),
('comment', {
'description': 'Comment about transition',
'default_expr': "python:state_change.kwargs.get('comment', '')",
'default_expression': "python:state_change.kwargs.get('comment', '')",
'for_status': 1,
'update_always': 1,
}),
('history', {
'description': 'Provides access to workflow history',
'default_expr': 'state_change/getHistory',
'default_expression': 'state_change/getHistory',
}),
('time', {
'description': 'Transition timestamp',
'default_expr': 'state_change/getDateTime',
'default_expression': '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_expr is not None:
expr = vdef.default_expr
if vdef.default_expression is not None:
expr = vdef.default_expression
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_expr is not None:
expr = vdef.default_expr
if vdef.default_expression is not None:
expr = vdef.default_expression
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_expr':'string', 'for_catalog':'int', 'for_status':'int',
'default_expression':'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_expr':
if property_id == 'default_expression':
expression = getattr(vdef, property_id, None)
if expression is not None:
property_value = expression.text
......
......@@ -140,13 +140,13 @@ class InteractionWorkflow(IdAsReferenceMixin("", "prefix"), Workflow):
getSecurityManager(), self, ob):
return default
status = self._getStatusOf(ob)
default_expr = vdef.getDefaultExpression()
default_expression = vdef.getDefaultExpression()
if status is not None and name in status:
value = status[name]
# Not set yet. Use a default.
elif default_expr is not None:
elif default_expression is not None:
ec = createExprContext(StateChangeInfo(ob, self, status))
value = Expression(default_expr)(ec)
value = Expression(default_expression)(ec)
else:
value = vdef.getInitialValue()
......@@ -280,9 +280,9 @@ class InteractionWorkflow(IdAsReferenceMixin("", "prefix"), Workflow):
# Preserve former value
value = former_status[id]
else:
default_expr = vdef.getDefaultExpression()
if default_expr is not None:
expr = Expression(default_expr)
default_expression = vdef.getDefaultExpression()
if default_expression is not None:
expr = Expression(default_expression)
else:
value = vdef.getInitialValue()
if expr is not None:
......@@ -459,7 +459,7 @@ class InteractionWorkflow(IdAsReferenceMixin("", "prefix"), Workflow):
# 2. Variable as XML
variable_reference_list = []
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 vdef in variable_list:
variable_reference_list.append(vdef.getReference())
......
......@@ -49,7 +49,7 @@ class Variable(IdAsReferenceMixin("variable_", "prefix"), XMLObject):
for_catalog = 1
for_status = 1
default_value = ''
default_expr = None # Overrides default_value if set
default_expression = None # Overrides default_value if set
update_always = 1
default_reference = ''
# Declarative security
......
......@@ -429,14 +429,14 @@ class Workflow(IdAsReferenceMixin("", "prefix"), XMLObject):
getSecurityManager(), self, ob):
return default
status = self.getCurrentStatusDict(ob)
default_expr = vdef.getDefaultExpression()
default_expression = vdef.getDefaultExpression()
if status is not None and status.has_key(name):
value = status[name]
# Not set yet. Use a default.
elif default_expr is not None:
elif default_expression is not None:
ec = createExprContext(StateChangeInfo(ob, self, status))
value = Expression(default_expr)(ec)
value = Expression(default_expression)(ec)
else:
value = vdef.getInitialValue()
......@@ -907,7 +907,7 @@ class Workflow(IdAsReferenceMixin("", "prefix"), XMLObject):
# 3. Variable as XML
variable_reference_list = []
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 vdef in variable_list:
variable_reference_list.append(vdef.getReference())
......@@ -934,7 +934,7 @@ class Workflow(IdAsReferenceMixin("", "prefix"), XMLObject):
sub_object.text = str(property_value)
# for a very specific case, action return the reference of transition,
# 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')
# 4. Worklist as XML
......@@ -1068,9 +1068,9 @@ class Workflow(IdAsReferenceMixin("", "prefix"), XMLObject):
# Preserve former value
value = former_status[id]
else:
default_expr = vdef.getDefaultExpression()
if default_expr is not None:
expr = Expression(default_expr)
default_expression = vdef.getDefaultExpression()
if default_expression is not None:
expr = Expression(default_expression)
else:
value = vdef.getInitialValue()
if expr is not None:
......@@ -1120,15 +1120,15 @@ class Workflow(IdAsReferenceMixin("", "prefix"), XMLObject):
status = self.getCurrentStatusDict(ob)
for vdef_ref, vdef in self.getVariableValueDict().iteritems():
if vdef.getForCatalog():
default_expr = vdef.getDefaultExpression()
default_expression = vdef.getDefaultExpression()
if status.has_key(vdef_ref):
value = status[vdef_ref]
# Not set yet. Use a default.
elif default_expr is not None:
elif default_expression is not None:
ec = createExprContext(StateChangeInfo(ob, self, status))
# convert string to expression before execute it.
value = Expression(default_expr)(ec)
value = Expression(default_expression)(ec)
else:
value = vdef.getInitialValue()
if hasattr(self, 'getSourceValue'):
......
......@@ -39,7 +39,7 @@ class WorklistVariable(IdAsReferenceMixin("variable_", "prefix"), XMLObject):
This type of object has 3 values:
- reference as Title;
- 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'
......@@ -49,7 +49,7 @@ class WorklistVariable(IdAsReferenceMixin("variable_", "prefix"), XMLObject):
isRADContent = 1
default_value = ''
default_expr = None # Overrides default_value if set
default_expression = None # Overrides default_value if set
default_reference = ''
# Declarative security
security = ClassSecurityInfo()
......
......@@ -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_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
# in order to generation correct workflow history.
if vid == 'action':
variable.setDefaultExpression('transition/getReference|nothing')
else: variable.setDefaultExpression(vdef.default_expr.text)
else: variable.setDefaultExpression(vdef.default_expression.text)
if vdef.info_guard:
variable.info_guard = vdef.info_guard
variable.setRoleList(vdef.info_guard.roles)
......
......@@ -126,7 +126,7 @@ class TestERP5Workflow(ERP5TypeTestCase):
v1 = workflow.newContent(portal_type='Variable',
title='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'))
doc = self.portal.newContent(portal_type='Folder', id='test_doc')
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