calc_value: join with multi

This commit is contained in:
Emmanuel Garette 2021-05-16 06:51:33 +02:00
parent 87093da974
commit a5b6352188

View file

@ -333,6 +333,31 @@ class CalcValue:
value = value[index] value = value[index]
else: else:
value = None value = None
else:
if join is not None:
if None not in value:
length_val = None
for val in value:
if isinstance(val, list):
if None in val:
length_val = None
break
lval = len(val)
if length_val is not None and length_val != lval:
raise ValueError(_(f'unexpected value in calc_value with join attribute "{val}" with invalid length "{length_val}"'))
length_val = lval
new_value = []
for idx in range(length_val):
idx_val = []
for val in value:
if isinstance(val, list):
idx_val.append(val[idx])
else:
idx_val.append(val)
new_value.append(join.join(idx_val))
value = new_value
else:
value = []
elif None in value and not allow_none: elif None in value and not allow_none:
value = [] value = []
elif remove_duplicate_value: elif remove_duplicate_value: