Commit b2c418cd authored by iv's avatar iv

ERP5Workflow: rename default_value (was initial_value) to variable_value

default_value was a bad name due to existing get/setDefaultValue on Base class
parent 61b4f638
...@@ -39,7 +39,7 @@ ...@@ -39,7 +39,7 @@
<value> <string>42</string> </value> <value> <string>42</string> </value>
</item> </item>
<item> <item>
<key> <string>default_value</string> </key> <key> <string>variable_value</string> </key>
<value> <string>python: member.getUserName()</string> </value> <value> <string>python: member.getUserName()</string> </value>
</item> </item>
<item> <item>
......
...@@ -39,7 +39,7 @@ ...@@ -39,7 +39,7 @@
<value> <string>43</string> </value> <value> <string>43</string> </value>
</item> </item>
<item> <item>
<key> <string>default_value</string> </key> <key> <string>variable_value</string> </key>
<value> <string>python: object.getDateTime()</string> </value> <value> <string>python: object.getDateTime()</string> </value>
</item> </item>
<item> <item>
......
...@@ -39,7 +39,7 @@ ...@@ -39,7 +39,7 @@
<value> <string>44</string> </value> <value> <string>44</string> </value>
</item> </item>
<item> <item>
<key> <string>default_value</string> </key> <key> <string>variable_value</string> </key>
<value> <string>python: None</string> </value> <value> <string>python: None</string> </value>
</item> </item>
<item> <item>
......
...@@ -39,7 +39,7 @@ ...@@ -39,7 +39,7 @@
<value> <string>45</string> </value> <value> <string>45</string> </value>
</item> </item>
<item> <item>
<key> <string>default_value</string> </key> <key> <string>variable_value</string> </key>
<value> <string>python: None</string> </value> <value> <string>python: None</string> </value>
</item> </item>
<item> <item>
......
...@@ -39,7 +39,7 @@ ...@@ -39,7 +39,7 @@
<value> <string>46</string> </value> <value> <string>46</string> </value>
</item> </item>
<item> <item>
<key> <string>default_value</string> </key> <key> <string>variable_value</string> </key>
<value> <string>python: request.get(\'configuration_save_url\', None)</string> </value> <value> <string>python: request.get(\'configuration_save_url\', None)</string> </value>
</item> </item>
<item> <item>
......
...@@ -60,7 +60,7 @@ ...@@ -60,7 +60,7 @@
<value> <string>47</string> </value> <value> <string>47</string> </value>
</item> </item>
<item> <item>
<key> <string>default_value</string> </key> <key> <string>variable_value</string> </key>
<value> <value>
<none/> <none/>
</value> </value>
......
...@@ -37,7 +37,7 @@ ...@@ -37,7 +37,7 @@
<value> <string>52</string> </value> <value> <string>52</string> </value>
</item> </item>
<item> <item>
<key> <string>default_value</string> </key> <key> <string>variable_value</string> </key>
<value> <string>python: request.get(\'client_id\', None)</string> </value> <value> <string>python: request.get(\'client_id\', None)</string> </value>
</item> </item>
<item> <item>
......
...@@ -39,7 +39,7 @@ ...@@ -39,7 +39,7 @@
<value> <string>59</string> </value> <value> <string>59</string> </value>
</item> </item>
<item> <item>
<key> <string>default_value</string> </key> <key> <string>variable_value</string> </key>
<value> <string>python: request.get(\'transition\', None)</string> </value> <value> <string>python: request.get(\'transition\', None)</string> </value>
</item> </item>
<item> <item>
......
...@@ -145,7 +145,7 @@ class TestWorklist(testWorkflowMixin): ...@@ -145,7 +145,7 @@ class TestWorklist(testWorkflowMixin):
for worklist_variable_key, worklist_variable_value in kw.iteritems(): for worklist_variable_key, worklist_variable_value in kw.iteritems():
worklist_variable = worklist_value.newContent(portal_type='Worklist Variable', worklist_variable = worklist_value.newContent(portal_type='Worklist Variable',
default_value=worklist_variable_value, variable_value=worklist_variable_value,
reference=worklist_variable_key) reference=worklist_variable_key)
if isinstance(worklist_variable_value, str) and worklist_variable_value.startswith('python'): if isinstance(worklist_variable_value, str) and worklist_variable_value.startswith('python'):
worklist_variable.setDefaultExpression(worklist_variable_value) worklist_variable.setDefaultExpression(worklist_variable_value)
......
...@@ -84,7 +84,7 @@ ...@@ -84,7 +84,7 @@
<value> <value>
<list> <list>
<string>my_causality</string> <string>my_causality</string>
<string>my_default_value</string> <string>my_variable_value</string>
<string>my_default_expression</string> <string>my_default_expression</string>
</list> </list>
</value> </value>
......
...@@ -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_value</string> </value> <value> <string>my_variable_value</string> </value>
</item> </item>
<item> <item>
<key> <string>message_values</string> </key> <key> <string>message_values</string> </key>
......
...@@ -92,7 +92,7 @@ ...@@ -92,7 +92,7 @@
<string>my_for_catalog</string> <string>my_for_catalog</string>
<string>my_for_status</string> <string>my_for_status</string>
<string>my_automatic_update</string> <string>my_automatic_update</string>
<string>my_default_value</string> <string>my_variable_value</string>
<string>my_default_expression</string> <string>my_default_expression</string>
</list> </list>
</value> </value>
......
...@@ -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_value</string> </value> <value> <string>my_variable_value</string> </value>
</item> </item>
<item> <item>
<key> <string>message_values</string> </key> <key> <string>message_values</string> </key>
......
...@@ -84,7 +84,7 @@ ...@@ -84,7 +84,7 @@
<value> <value>
<list> <list>
<string>my_reference</string> <string>my_reference</string>
<string>my_default_value</string> <string>my_variable_value</string>
<string>my_default_expression</string> <string>my_default_expression</string>
</list> </list>
</value> </value>
......
...@@ -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_value</string> </value> <value> <string>my_variable_value</string> </value>
</item> </item>
<item> <item>
<key> <string>message_values</string> </key> <key> <string>message_values</string> </key>
......
...@@ -87,13 +87,13 @@ class ConfigurationTransition(XMLObject): ...@@ -87,13 +87,13 @@ class ConfigurationTransition(XMLObject):
if variable_title in form_kw: if variable_title in form_kw:
status_dict[variable_title] = form_kw[variable_title] status_dict[variable_title] = form_kw[variable_title]
else: else:
status_dict[variable_title] = variable.getDefaultValue(object=object) status_dict[variable_title] = variable.getVariableValue(object=object)
# Update all transition variables # Update all transition variables
if form_kw is not None: if form_kw is not None:
object.REQUEST.other.update(form_kw) object.REQUEST.other.update(form_kw)
for variable in self.contentValues(portal_type='Transition Variable'): for variable in self.contentValues(portal_type='Transition Variable'):
status_dict[variable.getCausalityTitle()] = variable.getDefaultValue(object=object) status_dict[variable.getCausalityTitle()] = variable.getVariableValue(object=object)
workflow._updateWorkflowHistory(document, status_dict) workflow._updateWorkflowHistory(document, status_dict)
......
...@@ -78,7 +78,7 @@ class ConfigurationWorkflow(XMLObject): ...@@ -78,7 +78,7 @@ class ConfigurationWorkflow(XMLObject):
status_dict = {state_bc_id: self.getSource()} status_dict = {state_bc_id: self.getSource()}
variable_list = self.contentValues(portal_type='Variable') variable_list = self.contentValues(portal_type='Variable')
for variable in variable_list: for variable in variable_list:
status_dict[variable.getTitle()] = variable.getDefaultValue(object=object) status_dict[variable.getTitle()] = variable.getVariableValue(object=object)
self._updateWorkflowHistory(document, status_dict) self._updateWorkflowHistory(document, status_dict)
def _generateHistoryKey(self): def _generateHistoryKey(self):
......
...@@ -148,7 +148,7 @@ class InteractionWorkflow(IdAsReferenceMixin("", "prefix"), Workflow): ...@@ -148,7 +148,7 @@ class InteractionWorkflow(IdAsReferenceMixin("", "prefix"), Workflow):
ec = createExprContext(StateChangeInfo(ob, self, status)) ec = createExprContext(StateChangeInfo(ob, self, status))
value = Expression(default_expression)(ec) value = Expression(default_expression)(ec)
else: else:
value = vdef.getDefaultValue() value = vdef.getVariableValue()
return value return value
...@@ -290,7 +290,7 @@ class InteractionWorkflow(IdAsReferenceMixin("", "prefix"), Workflow): ...@@ -290,7 +290,7 @@ class InteractionWorkflow(IdAsReferenceMixin("", "prefix"), Workflow):
if default_expression is not None: if default_expression is not None:
expression = Expression(default_expression) expression = Expression(default_expression)
else: else:
value = vdef.getDefaultValue() value = vdef.getVariableValue()
if expression is not None: if expression is not None:
# Evaluate an expression. # Evaluate an expression.
if econtext is None: if econtext is None:
...@@ -481,10 +481,10 @@ class InteractionWorkflow(IdAsReferenceMixin("", "prefix"), Workflow): ...@@ -481,10 +481,10 @@ class InteractionWorkflow(IdAsReferenceMixin("", "prefix"), Workflow):
if property_id == 'update_always': if property_id == 'update_always':
property_value = vdef.getAutomaticUpdate() property_value = vdef.getAutomaticUpdate()
sub_object = SubElement(variable, property_id, attrib=dict(type='int')) sub_object = SubElement(variable, property_id, attrib=dict(type='int'))
elif property_id == 'default_value': elif property_id == 'variable_value':
property_value = vdef.getDefaultValue() property_value = vdef.getVariableValue()
if vdef.getDefaultValue() is not None: if vdef.getVariableValue() is not None:
property_value = vdef.getDefaultValue() property_value = vdef.getVariableValue()
sub_object = SubElement(variable, property_id, attrib=dict(type='string')) sub_object = SubElement(variable, property_id, attrib=dict(type='string'))
else: else:
property_value = vdef.getProperty(property_id) property_value = vdef.getProperty(property_id)
......
...@@ -48,8 +48,8 @@ class Variable(IdAsReferenceMixin("variable_", "prefix"), XMLObject): ...@@ -48,8 +48,8 @@ class Variable(IdAsReferenceMixin("variable_", "prefix"), XMLObject):
description = '' description = ''
for_catalog = 1 for_catalog = 1
for_status = 1 for_status = 1
default_value = '' variable_value = ''
default_expression = None # Overrides default_value if set default_expression = None # Overrides variable_value if set
update_always = 1 update_always = 1
default_reference = '' default_reference = ''
# Declarative security # Declarative security
......
...@@ -439,7 +439,7 @@ class Workflow(IdAsReferenceMixin("", "prefix"), XMLObject): ...@@ -439,7 +439,7 @@ class Workflow(IdAsReferenceMixin("", "prefix"), XMLObject):
ec = createExprContext(StateChangeInfo(ob, self, status)) ec = createExprContext(StateChangeInfo(ob, self, status))
value = Expression(default_expression)(ec) value = Expression(default_expression)(ec)
else: else:
value = vdef.getDefaultValue() value = vdef.getVariableValue()
return value return value
...@@ -664,7 +664,7 @@ class Workflow(IdAsReferenceMixin("", "prefix"), XMLObject): ...@@ -664,7 +664,7 @@ class Workflow(IdAsReferenceMixin("", "prefix"), XMLObject):
if vdef.getDefaultExpression() is not None: if vdef.getDefaultExpression() is not None:
expr = vdef.getDefaultExpression() expr = vdef.getDefaultExpression()
else: else:
value = vdef.getDefaultValue(object=object) value = vdef.getVariableValue(object=object)
if expr is not None and expr != '': if expr is not None and expr != '':
# Evaluate an expression. # Evaluate an expression.
if econtext is None: if econtext is None:
...@@ -913,10 +913,10 @@ class Workflow(IdAsReferenceMixin("", "prefix"), XMLObject): ...@@ -913,10 +913,10 @@ class Workflow(IdAsReferenceMixin("", "prefix"), XMLObject):
if property_id == 'update_always': if property_id == 'update_always':
property_value = vdef.getAutomaticUpdate() property_value = vdef.getAutomaticUpdate()
sub_object = SubElement(variable, property_id, attrib=dict(type='int')) sub_object = SubElement(variable, property_id, attrib=dict(type='int'))
elif property_id == 'default_value': elif property_id == 'variable_value':
property_value = vdef.getDefaultValue() property_value = vdef.getVariableValue()
if vdef.getDefaultValue() is not None: if vdef.getVariableValue() is not None:
property_value = vdef.getDefaultValue() property_value = vdef.getVariableValue()
sub_object = SubElement(variable, property_id, attrib=dict(type='string')) sub_object = SubElement(variable, property_id, attrib=dict(type='string'))
else: else:
property_value = vdef.getProperty(property_id) property_value = vdef.getProperty(property_id)
...@@ -1065,7 +1065,7 @@ class Workflow(IdAsReferenceMixin("", "prefix"), XMLObject): ...@@ -1065,7 +1065,7 @@ class Workflow(IdAsReferenceMixin("", "prefix"), XMLObject):
if default_expression is not None: if default_expression is not None:
expr = Expression(default_expression) expr = Expression(default_expression)
else: else:
value = vdef.getDefaultValue() value = vdef.getVariableValue()
if expr is not None: if expr is not None:
# Evaluate an expression. # Evaluate an expression.
if econtext is None: if econtext is None:
...@@ -1123,7 +1123,7 @@ class Workflow(IdAsReferenceMixin("", "prefix"), XMLObject): ...@@ -1123,7 +1123,7 @@ class Workflow(IdAsReferenceMixin("", "prefix"), XMLObject):
# convert string to expression before execute it. # convert string to expression before execute it.
value = Expression(default_expression)(ec) value = Expression(default_expression)(ec)
else: else:
value = vdef.getDefaultValue() value = vdef.getVariableValue()
if hasattr(self, 'getSourceValue'): if hasattr(self, 'getSourceValue'):
if self.getSourceValue() is not None: if self.getSourceValue() is not None:
initial_state = self.getSourceValue().getReference() initial_state = self.getSourceValue().getReference()
......
...@@ -145,7 +145,7 @@ class Worklist(IdAsReferenceMixin("worklist_", "prefix"), XMLObject): ...@@ -145,7 +145,7 @@ class Worklist(IdAsReferenceMixin("worklist_", "prefix"), XMLObject):
worklist_variable_value = self.newContent(portal_type='Worklist Variable') worklist_variable_value = self.newContent(portal_type='Worklist Variable')
worklist_variable_value.setReference(variable_value_ref) worklist_variable_value.setReference(variable_value_ref)
worklist_variable_value.setDefaultExpression(variable_value.getDefaultExpression()) worklist_variable_value.setDefaultExpression(variable_value.getDefaultExpression())
worklist_variable_value.setDefaultValue(variable_value.getDefaultValue()) worklist_variable_value.setVariableValue(variable_value.getVariableValue())
res.append(worklist_variable_value) res.append(worklist_variable_value)
if worklist_variable_value and worklist_variable_value not in res and variable_value.getForCatalog() == 1: if worklist_variable_value and worklist_variable_value not in res and variable_value.getForCatalog() == 1:
res.append(worklist_variable_value) res.append(worklist_variable_value)
...@@ -174,7 +174,7 @@ class Worklist(IdAsReferenceMixin("worklist_", "prefix"), XMLObject): ...@@ -174,7 +174,7 @@ class Worklist(IdAsReferenceMixin("worklist_", "prefix"), XMLObject):
if self.getMatchedCausalityState() is not None: if self.getMatchedCausalityState() is not None:
key_list.append('causality_state') key_list.append('causality_state')
for dynamic_variable in self.objectValues(): for dynamic_variable in self.objectValues():
if dynamic_variable.getDefaultValue() or dynamic_variable.getDefaultExpression(): if dynamic_variable.getVariableValue() or dynamic_variable.getDefaultExpression():
key_list.append(dynamic_variable.getReference()) key_list.append(dynamic_variable.getReference())
return key_list return key_list
...@@ -203,8 +203,8 @@ class Worklist(IdAsReferenceMixin("worklist_", "prefix"), XMLObject): ...@@ -203,8 +203,8 @@ class Worklist(IdAsReferenceMixin("worklist_", "prefix"), XMLObject):
elif id: elif id:
# Local dynamic variable: # Local dynamic variable:
dynamic_variable = self._getOb('variable_'+id) dynamic_variable = self._getOb('variable_'+id)
if dynamic_variable.getDefaultValue(): if dynamic_variable.getVariableValue():
matches = [dynamic_variable.getDefaultValue()] matches = [dynamic_variable.getVariableValue()]
# Override initial value if expression set: # Override initial value if expression set:
if dynamic_variable.getDefaultExpression(): if dynamic_variable.getDefaultExpression():
matches = Expression(dynamic_variable.getDefaultExpression()) matches = Expression(dynamic_variable.getDefaultExpression())
......
...@@ -38,7 +38,7 @@ class WorklistVariable(IdAsReferenceMixin("variable_", "prefix"), XMLObject): ...@@ -38,7 +38,7 @@ class WorklistVariable(IdAsReferenceMixin("variable_", "prefix"), XMLObject):
A ERP5 Worklist Variable which serves as dynamic variable of Worklist. A ERP5 Worklist Variable which serves as dynamic variable of Worklist.
This type of object has 3 values: This type of object has 3 values:
- reference as Title; - reference as Title;
- default_value; - variable_value;
- default_expression which will override default when it's set. - default_expression which will override default when it's set.
""" """
...@@ -48,8 +48,8 @@ class WorklistVariable(IdAsReferenceMixin("variable_", "prefix"), XMLObject): ...@@ -48,8 +48,8 @@ class WorklistVariable(IdAsReferenceMixin("variable_", "prefix"), XMLObject):
isPortalContent = 1 isPortalContent = 1
isRADContent = 1 isRADContent = 1
default_value = '' variable_value = ''
default_expression = None # Overrides default_value if set default_expression = None # Overrides variable_value if set
default_reference = '' default_reference = ''
# Declarative security # Declarative security
security = ClassSecurityInfo() security = ClassSecurityInfo()
......
...@@ -410,7 +410,7 @@ class WorkflowTool(BaseTool, OriginalWorkflowTool): ...@@ -410,7 +410,7 @@ class WorkflowTool(BaseTool, OriginalWorkflowTool):
if isinstance(values, Expression): if isinstance(values, Expression):
worklist_variable_value.setDefaultExpression(values.text) worklist_variable_value.setDefaultExpression(values.text)
else: else:
worklist_variable_value.setDefaultValue(values) worklist_variable_value.setVariableValue(values)
worklist.setActboxUrl(qdef.actbox_url) worklist.setActboxUrl(qdef.actbox_url)
worklist.setActboxCategory(qdef.actbox_category) worklist.setActboxCategory(qdef.actbox_category)
...@@ -518,7 +518,7 @@ class WorkflowTool(BaseTool, OriginalWorkflowTool): ...@@ -518,7 +518,7 @@ class WorkflowTool(BaseTool, OriginalWorkflowTool):
variable.setExpression(tdef.info_guard.expr.text) variable.setExpression(tdef.info_guard.expr.text)
variable.setForCatalog(variable_definition.for_catalog) variable.setForCatalog(variable_definition.for_catalog)
variable.setForStatus(variable_definition.for_status) variable.setForStatus(variable_definition.for_status)
variable.setDefaultValue(variable_definition.default_value) variable.setVariableValue(variable_definition.default_value)
variable.setDescription(variable_definition.description) variable.setDescription(variable_definition.description)
# Configure transition variable: # Configure transition variable:
if getattr(dc_workflow, 'transitions', None) is not None: if getattr(dc_workflow, 'transitions', None) is not None:
......
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