support empty param

This commit is contained in:
Emmanuel Garette 2020-10-04 20:11:00 +02:00
parent 3040a11de9
commit 43e30bba47
4 changed files with 12 additions and 3 deletions

View File

@ -1037,6 +1037,9 @@ class ConstraintAnnotator:
raise DictConsistencyError(_(f"All '{param.type}' variables must have a value in order to calculate {fill.target}")) raise DictConsistencyError(_(f"All '{param.type}' variables must have a value in order to calculate {fill.target}"))
if param.type == 'suffix' and hasattr(param, 'text'): if param.type == 'suffix' and hasattr(param, 'text'):
raise DictConsistencyError(_(f"All '{param.type}' variables must not have a value in order to calculate {fill.target}")) raise DictConsistencyError(_(f"All '{param.type}' variables must not have a value in order to calculate {fill.target}"))
if param.type == 'string':
if not hasattr(param, 'text'):
param.text = None
if param.type == 'variable': if param.type == 'variable':
try: try:
param.text, suffix = self.objectspace.paths.get_variable_path(param.text, param.text, suffix = self.objectspace.paths.get_variable_path(param.text,

View File

@ -12,7 +12,9 @@
<constraints> <constraints>
<check name="valid_enum" target="mode_conteneur_actif"> <check name="valid_enum" target="mode_conteneur_actif">
<param>['a','b','c']</param> <param>a</param>
<param>b</param>
<param>c</param>
</check> </check>
</constraints> </constraints>

View File

@ -17,7 +17,9 @@
<constraints> <constraints>
<check name="valid_enum" target="enumvar"> <check name="valid_enum" target="enumvar">
<param>['a', 'b', 'c']</param> <param>a</param>
<param>b</param>
<param>c</param>
</check> </check>
</constraints> </constraints>

View File

@ -19,7 +19,9 @@
<constraints> <constraints>
<check name="valid_enum" target="enumvar"> <check name="valid_enum" target="enumvar">
<param>[1, 2, 3]</param> <param>1</param>
<param>2</param>
<param>3</param>
</check> </check>
</constraints> </constraints>