Refactor code for clarity

This commit is contained in:
Nicola Soranzo
2018-03-26 18:26:41 +01:00
parent 2b3557ffce
commit 91e97b6096
+3 -3
View File
@@ -859,7 +859,9 @@ class SelectToolParameter(ToolParameter):
if is_runtime_value(context_value) or has_runtime_datasets(trans, context_value):
workflow_building_mode = workflow_building_modes.ENABLED
break
if not legal_values and workflow_building_mode:
if not legal_values:
if not workflow_building_mode:
raise ValueError("Parameter %s requires a value, but has no legal values defined." % self.name)
if self.multiple:
# While it is generally allowed that a select value can be '',
# we do not allow this to be the case in a dynamically
@@ -878,8 +880,6 @@ class SelectToolParameter(ToolParameter):
if self.optional:
return None
raise ValueError("An invalid option was selected for %s, please verify." % (self.name))
elif not legal_values:
raise ValueError("Parameter %s requires a value, but has no legal values defined." % self.name)
if isinstance(value, list):
if not self.multiple:
raise ValueError("Multiple values provided but parameter %s is not expecting multiple values." % self.name)