Commit 6a8e0244 authored by Floreal Cabanettes's avatar Floreal Cabanettes
Browse files

Add AtLeastOneAmong rule

parent adb28111
......@@ -244,3 +244,20 @@ class ForbiddenChars(ValueRule):
for value in self.values_arg:
if value in self.parameter_value:
self.error("Character not allowed: \"" + value + "\"")
class AtLeastOneAmong(LinkRule):
"""
At least one parameter among the list must be set
"""
def check(self):
if self.parameter_value is None:
has_one = False
for grp_param in self.targets_args:
if not getattr(self.wf_instance, grp_param).is_None:
has_one = True
break
if not has_one:
all_required = [self.parameter_name] + self.targets_args
self.error("Please give at least one of these options:\n\t--" + "\n\t--".join(all_required))
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